client.workflow_run
The workflow run is an instance of a workflow.
Attributes
Classes
A utility class responsible for instantiating workflow run objects. |
|
WorkflowRun enables tracking for multiple runs of a single Workflow. |
Module Contents
- client.workflow_run.logger
- class client.workflow_run.WorkflowRunFactory(workflow_id: int, requester: jobmon.core.requester.Requester | None = None)
A utility class responsible for instantiating workflow run objects.
This class sends the appropriate resume signals so that the parent workflow object is in a state where the newly created workflowrun is ready to run, either on resume or not.
Initialization of client WorkflowRun.
- workflow_id
- requester = None
- workflow_is_resumable = False
- set_workflow_resume(reset_running_jobs: bool = True, resume_timeout: int = 300, force_cleanup: bool = False) None
Set statuses of the given workflow ID’s workflow to a resumable state.
Move active workflow runs to hot/cold resume states, depending on reset_running_jobs.
- Parameters:
reset_running_jobs – If True (cold resume), also terminate running tasks. If False (hot resume), let running tasks finish.
resume_timeout – Maximum time to wait for workflow to become resumable.
force_cleanup – If True and timeout is reached with pending KILL_SELF task instances, force cleanup and proceed. Use this when jobs have been externally terminated (scancel, node failure).
- wait_for_workflow_resume(resume_timeout: int = 300, force_cleanup: bool = False) None
Wait for workflow to become resumable.
- Parameters:
resume_timeout – Maximum time to wait in seconds
force_cleanup – If True and KILL_SELF task instances are detected, clean them up immediately instead of waiting for workers
- force_cleanup_kill_self() int
Force cleanup of stuck KILL_SELF task instances.
Use this when jobs have been externally terminated (e.g., scancel, node failure) and the workflow is stuck waiting for cleanup that will never happen.
- Returns:
Number of task instances cleaned up
- reset_task_statuses(reset_if_running: bool = True, force_cleanup: bool = False) None
Sets the tasks associated with a workflow to the appropriate states.
- Parameters:
reset_if_running – If True, also reset running tasks.
force_cleanup – If True and workflow not resumable due to stuck KILL_SELF task instances, force cleanup and proceed.
- class client.workflow_run.WorkflowRun(workflow_id: int, requester: jobmon.core.requester.Requester | None = None, workflow_run_heartbeat_interval: int | None = None, heartbeat_report_by_buffer: float | None = None)
Bases:
objectWorkflowRun enables tracking for multiple runs of a single Workflow.
A Workflow may be started/paused/ and resumed multiple times. Each start or resume represents a new WorkflowRun.
In order for a Workflow can be deemed to be DONE (successfully), it must have 1 or more WorkflowRuns. In the current implementation, a Workflow Job may belong to one or more WorkflowRuns, but once the Job reaches a DONE state, it will no longer be added to a subsequent WorkflowRun. However, this is not enforced via any database constraints.
Initialize client WorkflowRun.
- workflow_id
- user
- requester = None
- heartbeat_interval
- heartbeat_report_by_buffer