expose ERROR arguments that can be used in conditional hook/cleanup u…#100
Open
colonesej wants to merge 4 commits into
Open
expose ERROR arguments that can be used in conditional hook/cleanup u…#100colonesej wants to merge 4 commits into
colonesej wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the generated job shell preamble (via Host.preamble_error_function) to expose richer error/exit context to user-provided exit_hook logic by exporting EXIT_REASON, EXIT_DETAIL, and EXIT_RC, and by adjusting how traps invoke the ERROR handler.
Changes:
- Export
EXIT_REASON,EXIT_DETAIL, andEXIT_RCfrom theERRORtrap handler. - Update signal traps to capture
$?before invokingERROR. - Update the EXIT trap (
trap 0) to pass exit status information intoERROR.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d7b44c2 to
4e144e1
Compare
oiffrig
approved these changes
Jul 2, 2026
Collaborator
Author
|
example usage: ecmwf/pyflow-wellies#65 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request updates the error handling logic in the shell script generated by the
preamble_error_functioninpyflow/host.py. The main focus is to improve the way exit reasons, details, and return codes are captured and exported when errors or signals are trapped.Improvements to error handling and signal trapping:
ERRORhandler now exports three variables:EXIT_REASON,EXIT_DETAIL, andEXIT_RC, providing more detailed context for errors and exits.rc=$?) before invoking theERRORhandler, ensuring accurate reporting of the exit status when a signal is received.trap 0) is updated to pass the exit code to theERRORhandler, improving the accuracy of exit reporting.exit_hookimplementations that have conditional paths depending on task exit status.exit_hookis currently the only supported injection point for custom cleanup/post-execution logicContributor Declaration
By opening this pull request, I affirm the following: