-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(workflows): Add support for simulation integration (#1999)
- Loading branch information
1 parent
5d60284
commit 126d0c9
Showing
13 changed files
with
524 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from __future__ import annotations | ||
|
||
__version__ = "7.69.4" | ||
__version__ = "7.70.0" | ||
|
||
__api_subversion__ = "20230101" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from __future__ import annotations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
from __future__ import annotations | ||
|
||
from dataclasses import dataclass | ||
from typing import TYPE_CHECKING, Any | ||
|
||
from typing_extensions import Self | ||
|
||
from cognite.client.data_classes._base import ( | ||
CogniteObject, | ||
) | ||
from cognite.client.utils._experimental import FeaturePreviewWarning | ||
|
||
if TYPE_CHECKING: | ||
from cognite.client import CogniteClient | ||
|
||
_WARNING = FeaturePreviewWarning(api_maturity="General Availability", sdk_maturity="alpha", feature_name="Simulators") | ||
|
||
|
||
@dataclass | ||
class SimulationValueUnitName(CogniteObject): | ||
name: str | ||
|
||
@classmethod | ||
def _load(cls, resource: dict[str, Any], cognite_client: CogniteClient | None = None) -> Self: | ||
return cls( | ||
name=resource["name"], | ||
) | ||
|
||
def __post_init__(self) -> None: | ||
_WARNING.warn() | ||
|
||
def dump(self, camel_case: bool = True) -> dict[str, Any]: | ||
return super().dump(camel_case=camel_case) | ||
|
||
|
||
@dataclass | ||
class SimulationInputOverride(CogniteObject): | ||
reference_id: str | ||
value: str | int | float | list[str] | list[int] | list[float] | ||
unit: SimulationValueUnitName | None = None | ||
|
||
@classmethod | ||
def _load(cls, resource: dict[str, Any], cognite_client: CogniteClient | None = None) -> Self: | ||
return cls( | ||
reference_id=resource["referenceId"], | ||
value=resource["value"], | ||
unit=SimulationValueUnitName._load(resource["unit"], cognite_client) if "unit" in resource else None, | ||
) | ||
|
||
def __post_init__(self) -> None: | ||
_WARNING.warn() | ||
|
||
def dump(self, camel_case: bool = True) -> dict[str, Any]: | ||
output = super().dump(camel_case=camel_case) | ||
if self.unit is not None: | ||
output["unit"] = self.unit.dump(camel_case=camel_case) | ||
|
||
return output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
1 change: 1 addition & 0 deletions
1
tests/tests_integration/test_api/test_simulators/seed/empty_model.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
Oops, something went wrong.