How to control the execution of tasks
Task dependency using `assert like` helpers
@task(name="task-a")
def task_a(image_input: Image) -> bool:
return True
@task(name="task-b")
def task_b(image_input: Image) -> bool:
# If task-a not True, won't process further
self.assert_task_is("task-a", True)
# We can add custom message. Otherwise, a generic slug is sent
self.assert_task_is_not("task-a", False, "Oh nooooo, task-a is False"
return True# Asserts based on the value of a task from a previous analysis
self.assert_state_is("task_group_name", "task_name", value)
self.assert_state_is_not("task_group_name", "task_name", value)
# Asserts based on the value of the work order metadata
self.assert_wo_metadata_is("key", value)
self.assert_wo_metadata_is_not("key", value)
# Asserts based on the value of the analysis metadata
self.assert_analysis_metadata_is("key", value)
self.assert_analysis_metadata_is_not("key", value)
# Assert checking if a task has a value and was therefore correctly executed
self.assert_task_has_value("task_name")
# Asserts based on the value of a task from that current analysis
self.assert_task_is("task_name", value)
self.assert_task_is_not("task_name", value)
# Asserts based on the key in the workspace
self.assert_workspace_key_is("key", value)
self.assert_workspace_key_is_not("key", value)
Exceptions
TaskConformityError
DataConformityError
Was this helpful?