You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i'm using coiled from the command line to run scripts, and i'm encountering a challenge with capturing the exit status of my scripts. specifically, i'm trying to determine if there's a way to capture the exit status of a script (like sample.py) when running it with the coiled run command.
# contents of sample.pyimportsubprocesscommand="bash -c 'echox test'"result=subprocess.run(command, shell=True)
print(f'Exit Code: {result.returncode}')
# exit with the returncodeexit(result.returncode)
for instance, when i run the following command
$ coiled run sample.py
i get an output indicating the progress and the details of the run, followed by the exit code of the script. however, when I try to check the exit status immediately after the script finishes, using echo $?, it always returns 0, regardless of the actual exit status of sample.py.
calling the script directly w/ python, works as expected
$ python sample.py
bash: echox: command not found
Exit Code: 127
$ echo"$status$?"
127 127
it seems that the coiled run command might be masking the actual exit status of the script i am running. i'd appreciate guidance on how to properly catch the exit status of my script when running it through Coiled. this is crucial for my workflow, where i need to make decisions based on the success or failure of the script.
thank you ---
The text was updated successfully, but these errors were encountered:
Hi, @andersy005. You're correct that coiled run foo does not currently exit with the exit code from foo. This is something that would require some work on our end. I can take a look next week and see if this is easy for us to add.
That said, perhaps another solution would be to have your script print messages, and then to look for those messages in stdout from coiled run and have your workflow act based on that. I know that's less elegant, but would that work for you?
This is something that would require some work on our end. I can take a look next week and see if this is easy for us to add.
that would be perfect
That said, perhaps another solution would be to have your script print messages, and then to look for those messages in stdout from coiled run and have your workflow act based on that. I know that's less elegant, but would that work for you?
thank you very much for the suggestion. i hadn't thought about this idea. i tinkered with this approach of using the output to detect failures/exit codes from foo, and it's working :)
i'm using coiled from the command line to run scripts, and i'm encountering a challenge with capturing the exit status of my scripts. specifically, i'm trying to determine if there's a way to capture the exit status of a script (like
sample.py
) when running it with thecoiled run
command.for instance, when i run the following command
i get an output indicating the progress and the details of the run, followed by the exit code of the script. however, when I try to check the exit status immediately after the script finishes, using echo $?, it always returns 0, regardless of the actual exit status of
sample.py
.calling the script directly w/ python, works as expected
it seems that the coiled run command might be masking the actual exit status of the script i am running. i'd appreciate guidance on how to properly catch the exit status of my script when running it through Coiled. this is crucial for my workflow, where i need to make decisions based on the success or failure of the script.
thank you ---
The text was updated successfully, but these errors were encountered: