matflow.TaskCondition#
- class matflow.TaskCondition(source_task_ID, input_or_output, source_parameter, group_name=None, group_function=None)#
Bases:
TaskConditionAn element-wise condition on the execution of a task.
Methods
Generate from a string.
Return True if the condition is met (meaning the task should execute), False if the condition is not met (meaning the task should not execute), and None if the condition is not valid for the provided run (i.e.
Attributes
- Parameters:
- classmethod from_string(condition, workflow)#
Generate from a string.
Examples
The condition is met if the p1 output from task t1 is truthy: >>> TaskCondition.from_string(“tasks.t1.outputs.p1”, workflow) TaskCondition(…)
The condition is met if any values of the p1 output from task t1 in the group “my_group” are truthy:
>>> TaskCondition.from_string("tasks.t1.outputs.p1:any(my_group)", workflow) TaskCondition(...)
The condition is met if all values of the p1 output from task t1 in the group “my_group” are truthy:
>>> TaskCondition.from_string("tasks.t1.outputs.p1:all(my_group)", workflow) TaskCondition(...)
- test(run, task_ID)#
Return True if the condition is met (meaning the task should execute), False if the condition is not met (meaning the task should not execute), and None if the condition is not valid for the provided run (i.e. the run does not belong to the source task referenced by source_task_ID).