Skip to content

Commit

Permalink
Data Workflows: Fix transformation task output (#1633)
Browse files Browse the repository at this point in the history
jobId may not be available in case of a Transformations task in a scheduled state or in case of Transformation call failure
  • Loading branch information
VerstraeteBert authored Feb 20, 2024
1 parent 923288c commit 405ca14
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ Changes are grouped as follows
- `Fixed` for any bug fixes.
- `Security` in case of vulnerabilities.

## [7.21.1] - 2024-02-20
### Fixed
- Data Workflows: mark parameter `jobId` as optional in `TransformationTaskOutput`, as it may not be populated in case of a failure.

## [7.21.0] - 2024-02-10
### Added
- Parameter `sort` to `client.documents.list.
- Parameter `sort` to `client.documents.list`.

## [7.20.1] - 2024-02-19
### Fixed
Expand Down
2 changes: 1 addition & 1 deletion cognite/client/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import annotations

__version__ = "7.21.0"
__version__ = "7.21.1"
__api_subversion__ = "20230101"
6 changes: 3 additions & 3 deletions cognite/client/data_classes/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,18 +527,18 @@ class TransformationTaskOutput(WorkflowTaskOutput):
The transformation output is used to specify the output of a transformation task.
Args:
job_id (int): The job id of the transformation job.
job_id (int | None): The job id of the transformation job.
"""

task_type: ClassVar[str] = "transformation"

def __init__(self, job_id: int) -> None:
def __init__(self, job_id: int | None) -> None:
self.job_id = job_id

@classmethod
def load(cls, data: dict[str, Any]) -> TransformationTaskOutput:
output = data["output"]
return cls(output["jobId"])
return cls(output.get("jobId"))

def dump(self, camel_case: bool = True) -> dict[str, Any]:
return {("jobId" if camel_case else "job_id"): self.job_id}
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "cognite-sdk"

version = "7.21.0"
version = "7.21.1"
description = "Cognite Python SDK"
readme = "README.md"
documentation = "https://cognite-sdk-python.readthedocs-hosted.com"
Expand Down

0 comments on commit 405ca14

Please sign in to comment.