Closed ke4roh closed 5 years ago
We're basically going back to the ready check idea?
I can also see the parallel. They are different motivations with the same outcome. Steps cannot execute when their input is missing, true, and neither should they execute when other pre-conditions aren't met. This is explicitly adding a precondition for step execution so that there is a standardized way in implementations of AbstractStep to gate by boolean expressions.
To get the "when" parameter and evaluate it against the environment at runtime, we can save an unmodifiable Map of the config in the call to AbstractStep.init(...)
and inject that map into the environment with a new key in AbstractStep.getEnvironment(uuid)
Add a "when" parameter that takes a string which, once interpreted, yields a boolean. It should be tacitly run through Jinja, too, without the squigglies (or with them, if they're provided).
When this expression evaluates false, throw
StepDependencyNotMetException
. Perform this expression evaluation in an overridable method on AbstractTask.When all remaining pending steps for a section have thrown the exception, the section is complete and the steps need not wait further.