Data Workflows

Workflows

AsyncCogniteClient.workflows.delete(external_id)

Delete one or more workflows with versions.

AsyncCogniteClient.workflows.list([limit])

List workflows in the project.

AsyncCogniteClient.workflows.retrieve(...[, ...])

Retrieve one or more workflows.

AsyncCogniteClient.workflows.upsert(workflow)

Create one or more workflow(s).

Workflow Versions

AsyncCogniteClient.workflows.versions.delete(...)

Delete a workflow version(s).

AsyncCogniteClient.workflows.versions.list([...])

List workflow versions in the project.

AsyncCogniteClient.workflows.versions.retrieve(...)

Retrieve a workflow version.

AsyncCogniteClient.workflows.versions.upsert(version)

Create one or more workflow version(s).

Workflow Executions

AsyncCogniteClient.workflows.executions.cancel(id, ...)

Cancel a workflow execution.

AsyncCogniteClient.workflows.executions.list([...])

List workflow executions in the project.

AsyncCogniteClient.workflows.executions.retrieve_detailed(id)

Retrieve a workflow execution with detailed information.

AsyncCogniteClient.workflows.executions.retry(id)

Retry a workflow execution.

AsyncCogniteClient.workflows.executions.run(...)

Run a workflow execution.

Workflow Tasks

AsyncCogniteClient.workflows.tasks.update(...)

Update status of async task.

Workflow Triggers

AsyncCogniteClient.workflows.triggers.delete(...)

Delete one or more triggers for a workflow.

AsyncCogniteClient.workflows.triggers.list([limit])

List the workflow triggers.

AsyncCogniteClient.workflows.triggers.list_runs(...)

List the history of runs for a trigger.

AsyncCogniteClient.workflows.triggers.pause(...)

Pause a workflow trigger.

AsyncCogniteClient.workflows.triggers.resume(...)

Resume a paused workflow trigger.

AsyncCogniteClient.workflows.triggers.upsert(...)

Create or update a trigger for a workflow.

Data Workflows data classes

class cognite.client.data_classes.workflows.CDFTaskOutput(response: str | dict | None, status_code: int | None)

Bases: WorkflowTaskOutput

The CDF Request output is used to specify the output of a CDF Request.

Parameters:
  • response (str | dict | None) – The response of the CDF Request. Will be a JSON object if content-type is application/json, otherwise will be a string.

  • status_code (int | None) – The status code of the CDF Request.

class cognite.client.data_classes.workflows.CDFTaskParameters(
resource_path: str,
method: Literal['GET', 'POST', 'PUT', 'DELETE'] | str,
query_parameters: dict | str | None = None,
body: dict | str | None = None,
request_timeout_in_millis: int | str = 10000,
)

Bases: WorkflowTaskParameters

The CDF request parameters are used to specify a request to the Cognite Data Fusion API.

Parameters:
  • resource_path (str) – The resource path of the request. Note the path of the request which is prefixed by ‘{cluster}.cognitedata.com/api/v1/project/{project}’ based on the cluster and project of the request.

  • method (Literal['GET', 'POST', 'PUT', 'DELETE'] | str) – The HTTP method of the request.

  • query_parameters (dict | str | None) – The query parameters of the request. Defaults to None.

  • body (dict | str | None) – The body of the request. Defaults to None. Limited to 1024KiB in size

  • request_timeout_in_millis (int | str) – The timeout of the request in milliseconds. Defaults to 10000.

Examples

Call the asset/list endpoint with a limit of 10:

>>> from cognite.client.data_classes import WorkflowTask, CDFTaskParameters
>>> task = WorkflowTask(
...     external_id="task1",
...     parameters=CDFTaskParameters(
...         resource_path="/assets/list",
...         method="GET",
...         query_parameters={"limit": 10},
...     ),
... )
dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.workflows.DynamicTaskOutput

Bases: WorkflowTaskOutput

The dynamic task output is used to specify the output of a dynamic task.

class cognite.client.data_classes.workflows.DynamicTaskParameters(
tasks: list[WorkflowTask] | str,
)

Bases: WorkflowTaskParameters

The dynamic task parameters are used to specify a dynamic task.

When the tasks and their order of execution are determined at runtime, we use dynamic tasks. It takes the tasks parameter which is a Reference to an array of function, transformation, and cdf task definitions. This array should be generated and returned by a previous step in the workflow, for instance, a Cognite Function task.

Tip

You can reference data from other tasks or the workflow. You do this by following the format ${prefix.jsonPath} in the expression. Some valid option are:

  • ${workflow.input}: The workflow input.

  • ${<taskExternalId>.output}: The output of the task with the given external id.

  • ${<taskExternalId>.input}: The input of the task with the given external id.

  • ${<taskExternalId>.input.someKey}: A specific key within the input of the task with the given external id.

Parameters:

tasks (list[WorkflowTask] | str) – The tasks to be dynamically executed. The dynamic task is a string that is evaluated during the workflow’s execution. When calling Version Upsert, the tasks parameter must be a Reference string. When calling Execution details, the tasks parameter will be a list of WorkflowTask objects.

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.workflows.FunctionTaskOutput(
call_id: int | None,
function_id: int | None,
response: dict | None,
)

Bases: WorkflowTaskOutput

The class represent the output of Cognite Function task.

Parameters:
  • call_id (int | None) – The call_id of the CDF Function call.

  • function_id (int | None) – The function_id of the CDF Function.

  • response (dict | None) – The response of the CDF Function call.

class cognite.client.data_classes.workflows.FunctionTaskParameters(
external_id: str,
data: dict | str | None = None,
is_async_complete: bool | None = None,
)

Bases: WorkflowTaskParameters

The function parameters are used to specify the Cognite Function to be called.

Parameters:
  • external_id (str) – The external ID of the function to be called.

  • data (dict | str | None) – The data to be passed to the function. Defaults to None. The data can be used to specify the input to the function from previous tasks or the workflow input. See the tip below for more information.

  • is_async_complete (bool | None) – Whether the function is asynchronous. Defaults to None, which the API will interpret as False.

If a function is asynchronous, you need to call the client.workflows.tasks.update() endpoint to update the status of the task. While synchronous tasks update the status automatically.

Tip

You can dynamically specify data from other tasks or the workflow. You do this by following the format ${prefix.jsonPath} in the expression. The valid are:

  • ${workflow.input}: The workflow input.

  • ${<taskExternalId>.output}: The output of the task with the given external id.

  • ${<taskExternalId>.input}: The input of the task with the given external id.

  • ${<taskExternalId>.input.someKey}: A specific key within the input of the task with the given external id.

For example, if you have a workflow containing two tasks, and the external_id of the first task is task1 then, you can specify the data for the second task as follows:

>>> from cognite.client.data_classes import WorkflowTask, FunctionTaskParameters
>>> task = WorkflowTask(
...     external_id="task2",
...     parameters=FunctionTaskParameters(
...         external_id="cdf_deployed_function",
...         data={
...             "workflow_data": "${workflow.input}",
...             "task1_input": "${task1.input}",
...             "task1_output": "${task1.output}",
...         },
...     ),
... )
dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.workflows.SimulationTaskOutput(
run_id: int | None,
log_id: int | None,
status_message: str | None,
)

Bases: WorkflowTaskOutput

The class represent the output of Simulation execution.

Parameters:
  • run_id (int | None) – The run ID of the simulation run.

  • log_id (int | None) – The log ID of the simulation run.

  • status_message (str | None) – Status message of the simulation execution.

class cognite.client.data_classes.workflows.SimulationTaskParameters(
routine_external_id: str,
run_time: int | None = None,
inputs: list[SimulationInputOverride] | None = None,
)

Bases: WorkflowTaskParameters

The simulation parameters are used to specify the simulation routine to be executed.

Parameters:
  • routine_external_id (str) – The external ID of the simulation routine to be executed.

  • run_time (int | None) – Reference timestamp used for data pre-processing and data sampling.

  • inputs (list[SimulationInputOverride] | None) – List of input overrides.

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.workflows.SubworkflowReferenceParameters(workflow_external_id: str, version: str)

Bases: WorkflowTaskParameters

The subworkflow task parameters are used to specify a subworkflow task. When a workflow is made of stages with dependencies between them, we can use subworkflow tasks for convenience. The subworkflow reference is used to specifying a reference to another workflow which will be embedded into the execution at start time.

Parameters:
  • workflow_external_id (str) – The external ID of the referenced workflow.

  • version (str) – The version of the referenced workflow.

dump(
camel_case: bool = True,
) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.workflows.SubworkflowTaskOutput

Bases: WorkflowTaskOutput

The subworkflow task output is used to specify the output of a subworkflow task.

class cognite.client.data_classes.workflows.SubworkflowTaskParameters(
tasks: list[WorkflowTask],
)

Bases: WorkflowTaskParameters

The subworkflow task parameters are used to specify a subworkflow task.

When a workflow is made of stages with dependencies between them, we can use subworkflow tasks for convenience. It takes the tasks parameter which is an array of function, transformation, cdf, …, task definitions. This array needs to be statically set on the workflow definition (if it needs to be defined at runtime, use a dynamic task).

Parameters:

tasks (list[WorkflowTask]) – The tasks belonging to the subworkflow.

dump(
camel_case: bool = True,
) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.workflows.TransformationTaskOutput(job_id: int | None)

Bases: WorkflowTaskOutput

The transformation output is used to specify the output of a transformation task.

Parameters:

job_id (int | None) – The job id of the transformation job.

class cognite.client.data_classes.workflows.TransformationTaskParameters(
external_id: str,
concurrency_policy: Literal['fail', 'restartAfterCurrent', 'waitForCurrent'] = 'fail',
use_transformation_credentials: bool = False,
)

Bases: WorkflowTaskParameters

The transformation parameters are used to specify the transformation to be called.

Parameters:
  • external_id (str) – The external ID of the transformation to be called.

  • concurrency_policy (Literal['fail', 'restartAfterCurrent', 'waitForCurrent']) – Determines the behavior of the task if the Transformation is already running. fail: The task fails if another instance of the Transformation is currently running. waitForCurrent: The task will pause and wait for the already running Transformation to complete. Once completed, the task is completed. This mode is useful for preventing redundant Transformation runs. restartAfterCurrent: The task waits for the ongoing Transformation to finish. After completion, the task restarts the Transformation. This mode ensures that the most recent data can be used by following tasks.

  • use_transformation_credentials (bool) – If set to true, the transformation will be run using the client credentials configured on the transformation. If set to false, the transformation will be run using the client credentials used to trigger the workflow.

dump(
camel_case: bool = True,
) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.workflows.Workflow(
external_id: str,
created_time: int,
last_updated_time: int,
description: str | None = None,
data_set_id: int | None = None,
max_concurrent_executions: int | None = None,
)

Bases: WorkflowCore

This class represents a workflow. This is the read version, used when reading or listing workflows.

Parameters:
  • external_id (str) – The external ID provided by the client. Must be unique for the resource type.

  • created_time (int) – The time when the workflow was created. Unix timestamp in milliseconds.

  • last_updated_time (int) – The time when the workflow was last updated. Unix timestamp in milliseconds.

  • description (str | None) – Description of the workflow. Defaults to None.

  • data_set_id (int | None) – The id of the data set this workflow belongs to.

  • max_concurrent_executions (int | None) – Maximum concurrent executions for this workflow. Defaults to the project limit if not specified or explicitly set to None. Values exceeding the project limit are dynamically capped at runtime.

as_write() WorkflowUpsert

Returns this workflow in the writing format.

class cognite.client.data_classes.workflows.WorkflowCore(
external_id: str,
description: str | None = None,
data_set_id: int | None = None,
max_concurrent_executions: int | None = None,
)

Bases: WriteableCogniteResource[WorkflowUpsert], ABC

class cognite.client.data_classes.workflows.WorkflowDataModelingTriggerRule(
data_modeling_query: WorkflowTriggerDataModelingQuery,
batch_size: int | None = None,
batch_timeout: int | None = None,
)

Bases: WorkflowTriggerRule

This class represents a data modeling trigger rule.

Parameters:
  • data_modeling_query (WorkflowTriggerDataModelingQuery) – The data modeling query of the trigger.

  • batch_size (int | None) – The batch size of the trigger.

  • batch_timeout (int | None) – The batch timeout of the trigger.

dump(
camel_case: bool = True,
) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.workflows.WorkflowDefinition(
hash_: str,
tasks: list[WorkflowTask],
description: str | None = None,
)

Bases: WorkflowDefinitionCore

This class represents a workflow definition. This represents the read version of a workflow definition.

A workflow definition defines the tasks and order/dependencies of these tasks.

Parameters:
  • hash (str) – The hash of the tasks and description. This is used to uniquely identify the workflow definition as you can overwrite a workflow version.

  • tasks (list[WorkflowTask]) – The tasks of the workflow definition.

  • description (str | None) – The description of the workflow definition. Defaults to None.

as_write() WorkflowDefinitionUpsert

Returns this WorkflowDefinition in its write format.

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.workflows.WorkflowDefinitionCore(
tasks: list[WorkflowTask],
description: str | None = None,
)

Bases: WriteableCogniteResource[WorkflowDefinitionUpsert], ABC

This class represents a workflow definition.

A workflow definition defines the tasks and order/dependencies of these tasks.

Parameters:
  • tasks (list[WorkflowTask]) – The tasks of the workflow definition.

  • description (str | None) – The description of the workflow definition. Note that when updating a workflow definition description, it will always be overwritten also if it is set to None. Meaning if the workflow definition already has a description, and you want to keep it, you need to provide the description when updating it.

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.workflows.WorkflowDefinitionUpsert(
tasks: list[WorkflowTask],
description: str | None = None,
)

Bases: WorkflowDefinitionCore

This class represents a workflow definition. This represents the write/update version of a workflow definition.

A workflow definition defines the tasks and order/dependencies of these tasks.

Parameters:
  • tasks (list[WorkflowTask]) – The tasks of the workflow definition.

  • description (str | None) – The description of the workflow definition. Note that when updating a workflow definition description, it will always be overwritten also if it is set to None. Meaning if the workflow definition already has a description, and you want to keep it, you need to provide the description when updating it.

as_write() WorkflowDefinitionUpsert

Returns this WorkflowDefinitionUpsert in its write format.

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.workflows.WorkflowExecution(
id: str,
workflow_external_id: str,
status: Literal['completed', 'failed', 'running', 'terminated', 'timed_out'],
created_time: int,
version: str | None = None,
start_time: int | None = None,
end_time: int | None = None,
reason_for_incompletion: str | None = None,
metadata: dict | None = None,
)

Bases: CogniteResource

This class represents a workflow execution.

Parameters:
  • id (str) – The server generated id of the workflow execution.

  • workflow_external_id (str) – The external ID of the workflow.

  • status (WorkflowStatus) – The status of the workflow execution.

  • created_time (int) – The time when the workflow execution was created. Unix timestamp in milliseconds.

  • version (str | None) – The version of the workflow. Defaults to None.

  • start_time (int | None) – The start time of the workflow execution. Unix timestamp in milliseconds. Defaults to None.

  • end_time (int | None) – The end time of the workflow execution. Unix timestamp in milliseconds. Defaults to None.

  • reason_for_incompletion (str | None) – Provides the reason if the workflow did not complete successfully. Defaults to None.

  • metadata (dict | None) – Application specific metadata.

class cognite.client.data_classes.workflows.WorkflowExecutionDetailed(
id: str,
workflow_external_id: str,
workflow_definition: WorkflowDefinition,
status: Literal['completed', 'failed', 'running', 'terminated', 'timed_out'],
executed_tasks: list[WorkflowTaskExecution],
created_time: int,
version: str | None = None,
start_time: int | None = None,
end_time: int | None = None,
reason_for_incompletion: str | None = None,
input: dict | None = None,
metadata: dict | None = None,
)

Bases: WorkflowExecution

This class represents a detailed workflow execution.

A detailed workflow execution contains the input and output of each task in the workflow execution. In addition, it contains the workflow definition of the workflow.

Parameters:
  • id (str) – The server generated id of the workflow execution.

  • workflow_external_id (str) – The external ID of the workflow.

  • workflow_definition (WorkflowDefinition) – The workflow definition of the workflow.

  • status (WorkflowStatus) – The status of the workflow execution.

  • executed_tasks (list[WorkflowTaskExecution]) – The executed tasks of the workflow execution.

  • created_time (int) – The time when the workflow execution was created. Unix timestamp in milliseconds.

  • version (str | None) – The version of the workflow. Defaults to None.

  • start_time (int | None) – The start time of the workflow execution. Unix timestamp in milliseconds. Defaults to None.

  • end_time (int | None) – The end time of the workflow execution. Unix timestamp in milliseconds. Defaults to None.

  • reason_for_incompletion (str | None) – Provides the reason if the workflow did not complete successfully. Defaults to None.

  • input (dict | None) – Input arguments the workflow was triggered with.

  • metadata (dict | None) – Metadata set when the workflow was triggered.

dump(
camel_case: bool = True,
) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.workflows.WorkflowExecutionList(
resources: Sequence[T_CogniteResource],
)

Bases: CogniteResourceList[WorkflowExecution], InternalIdTransformerMixin

This class represents a list of workflow executions.

class cognite.client.data_classes.workflows.WorkflowIds(
workflow_ids: Collection[WorkflowVersionId],
)

Bases: UserList

This class represents a list of Workflow Version Identifiers.

class cognite.client.data_classes.workflows.WorkflowList(
resources: Sequence[T_CogniteResource],
)

Bases: WriteableCogniteResourceList[WorkflowUpsert, Workflow], ExternalIDTransformerMixin

This class represents a list of workflows.

as_write() WorkflowUpsertList

Returns these workflows in the writing format.

class cognite.client.data_classes.workflows.WorkflowScheduledTriggerRule(
cron_expression: str,
timezone: ZoneInfo | None = None,
)

Bases: WorkflowTriggerRule

This class represents a scheduled trigger rule.

Parameters:
  • cron_expression (str) – The cron specification for the scheduled trigger.

  • timezone (ZoneInfo | None) – The timezone in which the scheduled trigger should be evaluated. If not provided, UTC will be used as the default timezone on the server side.

dump(
camel_case: bool = True,
) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.workflows.WorkflowTask(
external_id: str,
parameters: WorkflowTaskParameters,
name: str | None = None,
description: str | None = None,
retries: int = 3,
timeout: int = 3600,
on_failure: Literal['abortWorkflow', 'skipTask'] = 'abortWorkflow',
depends_on: list[str] | None = None,
)

Bases: CogniteResource

This class represents a workflow task.

Note

Tasks do not distinguish between write and read versions.

Parameters:
  • external_id (str) – The external ID provided by the client. Must be unique for the resource type.

  • parameters (WorkflowTaskParameters) – The parameters of the task.

  • name (str | None) – The name of the task. Defaults to None.

  • description (str | None) – The description of the task. Defaults to None.

  • retries (int) – The number of retries for the task. Defaults to 3.

  • timeout (int) – The timeout of the task in seconds. Defaults to 3600.

  • on_failure (Literal['abortWorkflow', 'skipTask']) – The policy to handle failures and timeouts. Defaults to abortWorkflow. skipTask: For both failures and timeouts, the task will retry until the retries are exhausted. After that, the Task is marked as COMPLETED_WITH_ERRORS and the subsequent tasks are executed. abortWorkflow: In case of failures, retries will be performed until exhausted. After which the task is marked as FAILED and the Workflow is marked the same. In the event of a timeout, no retries are undertaken; the task is marked as TIMED_OUT and the Workflow is marked as FAILED.

  • depends_on (list[str] | None) – The external ids of the tasks that this task depends on. Defaults to None.

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.workflows.WorkflowTaskExecution(
id: str,
external_id: str,
status: Literal['in_progress', 'cancelled', 'failed', 'failed_with_terminal_error', 'completed', 'completed_with_errors', 'timed_out', 'skipped'],
input: WorkflowTaskParameters,
output: WorkflowTaskOutput,
version: str | None = None,
start_time: int | None = None,
end_time: int | None = None,
reason_for_incompletion: str | None = None,
)

Bases: CogniteResource

This class represents a task execution.

Parameters:
  • id (str) – The server generated id of the task execution.

  • external_id (str) – The external ID provided by the client. Must be unique for the resource type.

  • status (TaskStatus) – The status of the task execution.

  • input (WorkflowTaskParameters) – The input parameters of the task execution.

  • output (WorkflowTaskOutput) – The output of the task execution.

  • version (str | None) – The version of the task execution. Defaults to None.

  • start_time (int | None) – The start time of the task execution. Unix timestamp in milliseconds. Defaults to None.

  • end_time (int | None) – The end time of the task execution. Unix timestamp in milliseconds. Defaults to None.

  • reason_for_incompletion (str | None) – Provides the reason if the workflow did not complete successfully. Defaults to None.

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.workflows.WorkflowTaskOutput

Bases: ABC

class cognite.client.data_classes.workflows.WorkflowTaskParameters

Bases: CogniteResource, ABC

class cognite.client.data_classes.workflows.WorkflowTrigger(
external_id: str,
trigger_rule: WorkflowTriggerRule,
workflow_external_id: str,
workflow_version: str,
is_paused: bool,
created_time: int,
last_updated_time: int,
input: dict | None = None,
metadata: dict | None = None,
)

Bases: WorkflowTriggerCore

This class represents a workflow trigger.

Parameters:
  • external_id (str) – The external ID provided by the client. Must be unique for the resource type.

  • trigger_rule (WorkflowTriggerRule) – The trigger rule of the workflow version trigger.

  • workflow_external_id (str) – The external ID of the workflow.

  • workflow_version (str) – The version of the workflow.

  • is_paused (bool) – Whether the trigger is paused.

  • created_time (int) – The time when the workflow version trigger was created. Unix timestamp in milliseconds.

  • last_updated_time (int) – The time when the workflow version trigger was last updated. Unix timestamp in milliseconds.

  • input (dict | None) – The input data passed to the workflow when an execution is started.

  • metadata (dict | None) – Application specific metadata.

as_write() WorkflowTriggerUpsert

Returns this workflow trigger instance.

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.workflows.WorkflowTriggerCore(
external_id: str,
trigger_rule: WorkflowTriggerRule,
workflow_external_id: str,
workflow_version: str,
)

Bases: WriteableCogniteResource[WorkflowTriggerUpsert], ABC

This class represents a base class for a workflow trigger.

Parameters:
  • external_id (str) – The external ID provided by the client. Must be unique for the resource type.

  • trigger_rule (WorkflowTriggerRule) – The trigger rule of the workflow version trigger.

  • workflow_external_id (str) – The external ID of the workflow.

  • workflow_version (str) – The version of the workflow.

class cognite.client.data_classes.workflows.WorkflowTriggerDataModelingQuery(
with_: dict[str, ResultSetExpression],
select: dict[str, Select],
)

Bases: Query

This class represents a data modeling trigger query.

Parameters:
  • with (dict[str, ResultSetExpression]) – A dictionary of result set expressions to use in the query. The keys are used to reference the result set expressions in the select.

  • select (dict[str, Select]) – A dictionary of select expressions to use in the query. The keys must match the keys in the with_ dictionary. The select expressions define which properties to include in the result set.

class cognite.client.data_classes.workflows.WorkflowTriggerList(
resources: Sequence[T_CogniteResource],
)

Bases: WriteableCogniteResourceList[WorkflowTriggerUpsert, WorkflowTrigger], ExternalIDTransformerMixin

This class represents a list of workflow triggers.

as_write() WorkflowTriggerUpsertList

Returns a WorkflowTriggerUpsertList object with the same data.

class cognite.client.data_classes.workflows.WorkflowTriggerRule

Bases: CogniteResource, ABC

This is the base class for all workflow trigger rules.

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.workflows.WorkflowTriggerRun(
external_id: str,
fire_time: int,
workflow_external_id: str,
workflow_version: str,
status: Literal['success', 'failed'],
workflow_execution_id: str | None = None,
reason_for_failure: str | None = None,
)

Bases: CogniteResource

This class represents a workflow trigger run.

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.workflows.WorkflowTriggerRunList(
resources: Sequence[T_CogniteResource],
)

Bases: CogniteResourceList[WorkflowTriggerRun], ExternalIDTransformerMixin

This class represents a list of workflow trigger runs.

class cognite.client.data_classes.workflows.WorkflowTriggerUpsert(
external_id: str,
trigger_rule: WorkflowTriggerRule,
workflow_external_id: str,
workflow_version: str,
input: dict | None = None,
metadata: dict | None = None,
)

Bases: WorkflowTriggerCore

This class represents a workflow trigger for upsertion.

Parameters:
  • external_id (str) – The external ID provided by the client. Must be unique for the resource type.

  • trigger_rule (WorkflowTriggerRule) – The trigger rule of the workflow version trigger.

  • workflow_external_id (str) – The external ID of the workflow.

  • workflow_version (str) – The version of the workflow.

  • input (dict | None) – The input data of the workflow version trigger. Defaults to None.

  • metadata (dict | None) – Application specific metadata. Defaults to None.

as_write() WorkflowTriggerUpsert

Returns this workflow trigger create instance.

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.workflows.WorkflowTriggerUpsertList(
resources: Sequence[T_CogniteResource],
)

Bases: CogniteResourceList[WorkflowTriggerUpsert], ExternalIDTransformerMixin

class cognite.client.data_classes.workflows.WorkflowUpsert(
external_id: str,
description: str | None = None,
data_set_id: int | None = None,
max_concurrent_executions: int | None = None,
)

Bases: WorkflowCore

This class represents a workflow. This is the write version, used when creating or updating a workflow.

Parameters:
  • external_id (str) – The external ID provided by the client. Must be unique for the resource type.

  • description (str | None) – Description of the workflow. Note that when updating a workflow, the description will always be overwritten also if it is set to None. Meaning if the workflow already has a description, and you want to keep it, you need to provide the description when updating the workflow.

  • data_set_id (int | None) – The id of the data set this workflow belongs to. If a dataSetId is provided, any operations on this workflow, or its versions, executions, and triggers will require appropriate access to the data set. More information on data sets and their configuration can be found here: https://docs.cognite.com/cdf/data_governance/concepts/datasets/

  • max_concurrent_executions (int | None) – Maximum concurrent executions for this workflow. Defaults to the project limit if not specified or explicitly set to None. Values exceeding the project limit are dynamically capped at runtime.

as_write() WorkflowUpsert

Returns this workflow instance.

class cognite.client.data_classes.workflows.WorkflowUpsertList(
resources: Sequence[T_CogniteResource],
)

Bases: CogniteResourceList[WorkflowUpsert], ExternalIDTransformerMixin

class cognite.client.data_classes.workflows.WorkflowVersion(
workflow_external_id: str,
version: str,
workflow_definition: WorkflowDefinition,
created_time: int,
last_updated_time: int,
)

Bases: WorkflowVersionCore

This class represents a workflow version. This is the read variant, used when retrieving/listing a workflow variant.

Parameters:
  • workflow_external_id (str) – The external ID of the workflow.

  • version (str) – The version of the workflow.

  • workflow_definition (WorkflowDefinition) – The workflow definition of the workflow version.

  • created_time (int) – The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.

  • last_updated_time (int) – The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.

as_write() WorkflowVersionUpsert

Returns a WorkflowVersionUpsert object with the same data.

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.workflows.WorkflowVersionCore(workflow_external_id: str, version: str)

Bases: WriteableCogniteResource[WorkflowVersionUpsert], ABC

This class represents a workflow version.

Parameters:
  • workflow_external_id (str) – The external ID of the workflow.

  • version (str) – The version of the workflow.

class cognite.client.data_classes.workflows.WorkflowVersionId(workflow_external_id: str, version: str | None = None)

Bases: object

This class represents a Workflow Version Identifier.

Parameters:
  • workflow_external_id (str) – The external ID of the workflow.

  • version (str | None) – The version of the workflow. Defaults to None.

class cognite.client.data_classes.workflows.WorkflowVersionList(
resources: Sequence[T_CogniteResource],
)

Bases: WriteableCogniteResourceList[WorkflowVersionUpsert, WorkflowVersion]

This class represents a list of workflow versions.

as_ids() WorkflowIds

Returns a WorkflowIds object with the workflow version ids.

as_write() WorkflowVersionUpsertList

Returns a WorkflowVersionUpsertList object with the same data.

class cognite.client.data_classes.workflows.WorkflowVersionUpsert(
workflow_external_id: str,
version: str,
workflow_definition: WorkflowDefinitionUpsert,
)

Bases: WorkflowVersionCore

This class represents a workflow version. This is the write-variant, used when creating or updating a workflow variant.

Parameters:
  • workflow_external_id (str) – The external ID of the workflow.

  • version (str) – The version of the workflow.

  • workflow_definition (WorkflowDefinitionUpsert) – The workflow definition of the workflow version.

as_write() WorkflowVersionUpsert

Returns this WorkflowVersionUpsert instance.

dump(camel_case: bool = True) dict[str, Any]

Dump the instance into a json serializable Python data type.

Parameters:

camel_case (bool) – Use camelCase for attribute names. Defaults to True.

Returns:

A dictionary representation of the instance.

Return type:

dict[str, Any]

class cognite.client.data_classes.workflows.WorkflowVersionUpsertList(
resources: Sequence[T_CogniteResource],
)

Bases: CogniteResourceList[WorkflowVersionUpsert]

This class represents a list of workflow versions.

as_ids() WorkflowIds

Returns a WorkflowIds object with the workflow version ids.