-
Notifications
You must be signed in to change notification settings - Fork 24
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
Improve Exception Handling in Pre and Post Run Methods SCMSUITE-10131 SO107 #183
Merged
Conversation
This file contains 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
dormrod
force-pushed
the
DavidOrmrodMorley/fix_multijob_locking
branch
3 times, most recently
from
December 9, 2024 15:26
ff7e709
to
cf32f9a
Compare
dormrod
force-pushed
the
DavidOrmrodMorley/fix_multijob_locking
branch
from
December 9, 2024 15:31
cf32f9a
to
a7a376e
Compare
dormrod
commented
Dec 9, 2024
dormrod
changed the title
Improve Exception Handling in Pre and Post Run Methods
Improve Exception Handling in Pre and Post Run Methods SCMSUITE-10131 SO107
Dec 9, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not run tests yet, but code looks good to me. We should think a bit about which exceptions in job execution should be caught, and which ones should not. It seems that we are very liberally catching a lot now ...
robertrueger
approved these changes
Dec 11, 2024
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
The behaviour of exceptions raised in
prerun
andpostrun
methods of jobs was inconsistent and had issues, for example:SingleJob
with a serial runner would raise the exception in the main thread and so kill the script entirely (not just fail a job)This PR makes this behaviour consistent, by catching any exception raised in these job steps, marking the job as complete, and storing the error message.
Changes
To achieve this, the following changes were made:
get_errormsg
which was already implemented on theAMSJob
has been added to theJob
base class with some basic implementation_fail_on_exception
which handles exceptions for functions, marks the job and complete and notifies the parent multi-job_prepare
,_execute
and_finalize
_error_msg
which can be used byget_errormsg
The following changes were also made:
Job
to an actual abstract base class instead of just raising exceptions when the methods were called