cmem_client.models.workflow¤
Workflow models
A workflow is the DataIntegration task which moves data between datasets. The workflows
of all projects are the items of client.workflows, keyed by
{project_id}:{workflow_id}.
A workflow which came out of the repository carries a client, so it can start itself and report its own status instead of going back through the repository:
>>> from cmem_client.client import Client
>>> client = Client.from_env()
>>> workflow = client.workflows["my-project:my-workflow"]
>>> workflow.execute_wait_for_completion()
>>> workflow.get_status().concrete_status
Classes:
- Workflow – A workflow
- WorkflowSearchResultSet – Wrapper for the search API response envelope.
- WorkflowStatus – Workflow execution status
Attributes:
- ACTIVITY_NAME –
- ACTIVITY_TYPE_EXECUTE_DEFAULTWORKFLOW –
- ACTIVITY_TYPE_EXECUTE_LOCALWORKFLOW –
- ACTIVITY_TYPE_EXECUTE_WITH_PAYLOAD –
- VALID_WORKFLOW_STATUSES –
ACTIVITY_NAME¤
ACTIVITY_NAME = Literal['ExecuteDefaultWorkflow', 'ExecuteLocalWorkflow', 'ExecuteWorkflowWithPayload']
ACTIVITY_TYPE_EXECUTE_DEFAULTWORKFLOW¤
ACTIVITY_TYPE_EXECUTE_LOCALWORKFLOW¤
ACTIVITY_TYPE_EXECUTE_WITH_PAYLOAD¤
VALID_WORKFLOW_STATUSES¤
VALID_WORKFLOW_STATUSES = ['Idle', 'Not executed', 'Finished', 'Cancelled', 'Failed', 'Successful', 'Canceling', 'Running', 'Waiting']
Workflow¤
Bases: Model, ReadRepositoryItem
A workflow
Attributes:
- id (
str) – ID of the workflow, unique within its project. - label (
str) – Human readable name of the workflow. - project_id (
str) – ID of the project holding the workflow. Together withidit forms the{project_id}:{id}key of the repository. - project_label (
str) – Human readable name of that project. - variable_inputs (
list[str]) – IDs of the inputs which can be replaced at execution time, which is whatexecute_io()writes its payload into. - variable_outputs (
list[str]) – IDs of the outputs which can be replaced at execution time, which is whatexecute_io()reads its result from. - warnings (
list[str]) – Warnings DataIntegration reported for the workflow. - tags (
list[Tag]) – Tags attached to the workflow. - parameters (
dict) – Raw parameters as returned by the search endpoint. Excluded from serialization; the variable inputs and outputs are read out of it.
Functions:
- execute – Execute the workflow
- execute_wait_for_completion – Execute the workflow waiting for completion
- get_id – Get the workflow ID
- get_status – Get the status of the workflow execution.
- set_client – Set the client for this workflow
execute¤
Execute the workflow
execute_wait_for_completion¤
Execute the workflow waiting for completion
get_id¤
Get the workflow ID
get_status¤
Get the status of the workflow execution.
id¤
label¤
model_config¤
parameters¤
project_id¤
project_label¤
set_client¤
Set the client for this workflow
tags¤
variable_inputs¤
variable_outputs¤
warnings¤
WorkflowSearchResultSet¤
Bases: Model
Wrapper for the search API response envelope.
Attributes:
model_config¤
results¤
WorkflowStatus¤
Bases: Model
Workflow execution status
Attributes:
- status_name (
str) – Coarse state of the execution, e.g.Idle,RunningorFinished. - concrete_status (
str) – What the state amounts to, e.g.Successful,FailedorCancelled. This is the field to check once an execution finished. - progress (
float | None) – How far the execution got, in percent, orNoneif the workflow does not report progress. - failed (
bool) – Whether the execution failed. - message (
str) – Human readable status message. - last_update_time (
int) – When the status was last updated, as a Unix timestamp in milliseconds. - project (
str) – ID of the project holding the workflow. - task (
str) – ID of the workflow task. - activity (
str) – Name of the activity which runs the workflow. - activity_label (
str) – Human readable name of that activity. - queue_time (
datetime | None) – When the execution was queued. - start_time (
datetime | None) – When the execution actually started. - is_running (
bool) – Whether the execution is still going. Poll this to wait for a workflow, or letexecute_wait_for_completion()do it. - runtime (
int | None) – How long the execution took, in milliseconds. - cancelled (
bool | None) – Whether the execution was cancelled. - exception_message (
str | None) – Message of the exception which ended the execution, if one did.