Feature/standardize task execution #307
Merged
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 PR creates a new
_run
method on task specs that runs the tasks. This method should returnTrue
if execution was successful,False
if unsuccessful (success and failure are still currently conflated in theCOMPLETED
task state, but in the future we can differentiate them) orNone
if the task is not complete, in which case the state will be changed toWAITING
This will allow a custom script engine to execute scripts or service tasks to immediately return
None
while the task executes without holding up the rest of the workflow. The behavior of the default script engine executes scripts synchronously and returns True on successful completion. This preserves the current behavior.The old
_on_ready_hook
method can be used to execute code when the task becomesREADY
but before it is run; this makeson_ready_before
redundant so I've removed it.I've also changed the prediction model so that (1) we no longer always re-predict definite tasks and (2) the states actually change when
sync_children
is called. Definite tasks can still be re-predicted by providing an optional mask to_predict
.