Skip to content

Commit 6069ae0

Browse files
haakonvtJustAnotherNormalDevcursoragentgemini-code-assist[bot]
authored
feat(Workflows): Add missing unknown classes for future-compatibility (#2627)
Co-authored-by: Sachin Bhagwat <sachin.bhagwat@cognite.com> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 11cb462 commit 6069ae0

6 files changed

Lines changed: 430 additions & 128 deletions

File tree

cognite/client/_api/workflows/tasks.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,25 @@ def update(
3333
3434
>>> from cognite.client import CogniteClient
3535
>>> client = CogniteClient()
36-
>>> res = client.workflows.tasks.update("000560bc-9080-4286-b242-a27bb4819253", "completed")
36+
>>> res = client.workflows.tasks.update(
37+
... "000560bc-9080-4286-b242-a27bb4819253", status="completed"
38+
... )
3739
3840
Update task with id '000560bc-9080-4286-b242-a27bb4819253' to status 'failed' with output '{"a": 1, "b": 2}':
3941
40-
>>> res = client.workflows.tasks.update("000560bc-9080-4286-b242-a27bb4819253", "failed", output={"a": 1, "b": 2})
42+
>>> res = client.workflows.tasks.update(
43+
... "000560bc-9080-4286-b242-a27bb4819253", status="failed", output={"a": 1, "b": 2}
44+
... )
4145
4246
Trigger workflow, retrieve detailed task execution and update status of the second task (assumed to be async) to 'completed':
4347
4448
>>> res = client.workflows.executions.run("my workflow", "1")
4549
>>> res = client.workflows.executions.retrieve_detailed(res.id)
46-
>>> res = client.workflows.tasks.update(res.tasks[1].id, "completed")
50+
>>> res = client.workflows.tasks.update(res.tasks[1].id, status="completed")
4751
4852
"""
4953
body: dict[str, Any] = {"status": status.upper()}
5054
if output is not None:
5155
body["output"] = output
5256
response = self._post(url_path=f"{self._RESOURCE_PATH}/{task_id}/update", json=body)
53-
return WorkflowTaskExecution.load(response.json())
57+
return WorkflowTaskExecution._load(response.json())

cognite/client/data_classes/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,8 @@
296296
SubworkflowTaskParameters,
297297
TransformationTaskOutput,
298298
TransformationTaskParameters,
299+
UnknownWorkflowTaskOutput,
300+
UnknownWorkflowTaskParameters,
299301
Workflow,
300302
WorkflowDefinition,
301303
WorkflowDefinitionUpsert,
@@ -568,6 +570,8 @@
568570
"TransformationUpdate",
569571
"TransformationWrite",
570572
"TransformationWriteList",
573+
"UnknownWorkflowTaskOutput",
574+
"UnknownWorkflowTaskParameters",
571575
"UserProfile",
572576
"UserProfileList",
573577
"View",

0 commit comments

Comments
 (0)