fix: Independent decorator task exec lifecycles #2231
Draft
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.
Exceptions during task exec lifecycles (
task_pre_step/task_decorate/task_post_step
) in decorators can currently impact the calling of other decorator lifecycles.Example:
The above flow will currently break due to
@secrets
raising an exception@kubernetes
from havingtask_pre_step
called, which is supposed to bindself.metadata
self.metadata
in turn makestask_finished
fail for@kubernetes
.Issues:
@kubernetes
exceptions, making debugging nontrivialtask_pre_step
being blocked for@kubernetes
, we end up missing metadata records (pod name etc.) which would have been recorded during this.Proposal is to instead execute all the lifecycle methods independently, collecting exceptions and raising only at the end of iteration. This will ensure that decorators do not interfere with each others lifecycles via exceptions, and a decorator can more reliably perform data passing between its own lifecycle methods
Side note: The issue is dependent on decorator ordering.