Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-32435 Implemented propagation of pipetask kill by signal #68

Merged
merged 1 commit into from
Nov 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion python/lsst/ctrl/bps/wms/panda/edgenode/cmd_line_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,11 @@ def deliver_input_files(src_path, files, skip_copy):
cmd_line = cmd_line.replace("{" + key + "}", value)

print(cmd_line)
sys.exit(os.WEXITSTATUS(os.system(cmd_line)))

exit_status = os.system(cmd_line)
exit_code = 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if using 1 as a default value will cause any confusion down the road with the exit 1 from the actual command. I was wondering if could use 128 instead, but haven't tested it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK, exit code 1 is the "Catchall for general errors". It will be emitted if pipetask does not provide any exit code and there was not a signal which leads to the pipetask termination. If the program terminates beyond that two cases I would assign such a case to "undefined behavior" and classify as a general error. According to this: https://tldp.org/LDP/abs/html/exitcodes.html code 128 is the "Invalid argument to exit".

if os.WIFSIGNALED(exit_status):
exit_code = os.WTERMSIG(exit_status) + 128
elif os.WIFEXITED(exit_status):
exit_code = os.WEXITSTATUS(exit_status)
sys.exit(exit_code)