demo of retry handlers returning a substitute value rather than choosing to retry or fail #3553
+90
−4
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.
This is a prototype I've made for @svandenhaute but maybe also of interest to Micha Pfeiffer
This prototype allows a retry handler to decide that on a particular task failure, the task should complete with a value of its own choosing.
In the scenario I talked of with @svandenhaute this would allow a tasks exception to be replaced by a substitute value that later other tasks would be able to observe - rather than task flow stopping - and so in a sense allows reification of the exception in a regular value.
In Micha's case, this may be a route to "permanently failing" a task into the checkpoint database, so that it does not re-run when restarting from checkpoints. (or might not - because this code means that other parts of a workflow will no longer observe a failure)
The supplied test case shows catching a particular exception and making that task not fail but instead complete with the value 8.
I'm unclear how this works in practice but the prototype was quick to make and I appreciate feedback.
Changed Behaviour
none
Type of change