-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(workflows): Add support for simulation integration #1999
Merged
Merged
Changes from 16 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
d9aa2df
feat(workflows): Add support for simulation integration
lpereiracgn 7af7c48
Merge branch 'master' into POFSP-744-workflows
lpereiracgn e774b84
bump version
lpereiracgn 4f54bbb
fix: field rename for simint tasks
lpereiracgn bb14a52
fix: types for simint runs
lpereiracgn c81726d
fix: remove old test for simint integration
lpereiracgn 7715f46
Merge branch 'master' into POFSP-744-workflows
lpereiracgn fa6e0da
fix lint
lpereiracgn f1956ca
Merge branch 'master' into POFSP-744-workflows
polomani 2e12eaf
add the test back
polomani 8f0b7aa
bump the version
polomani 9c76886
fix: accommodate API changes
polomani 33a1229
Merge branch 'master' into POFSP-744-workflows
polomani 5afe4e7
chore: lint
polomani 4cd9f96
Merge branch 'POFSP-744-workflows' of github.com:cognitedata/cognite-…
polomani b3f4e24
Merge branch 'master' into POFSP-744-workflows
polomani 67644aa
Update cognite/client/data_classes/workflows.py
polomani d3ede59
Update cognite/client/data_classes/simulators.py
polomani 5f47f76
chore: type
polomani 0a097d7
Merge branch 'master' into POFSP-744-workflows
polomani 64ac4ae
fix: type according to the spec
polomani 8a3d818
Merge branch 'POFSP-744-workflows' of github.com:cognitedata/cognite-…
polomani 072072e
Merge branch 'master' into POFSP-744-workflows
polomani af161f4
Merge branch 'POFSP-744-workflows' of github.com:cognitedata/cognite-…
polomani 79310dd
fix: changelog
polomani d7608c2
tests: add e2e simint workflow test
polomani 37608a0
fix: update workflow type
polomani bc432db
chore: fmt
polomani ae1c179
fix: move fixture
polomani 1a3eb6c
fix: small fix
polomani 0317216
fix: move class to a folder
polomani 61e618f
fix: put a warning
polomani 5896faf
Merge branch 'master' into POFSP-744-workflows
polomani ee8a10e
tests: move files around
polomani 4ae69a2
Merge branch 'POFSP-744-workflows' of github.com:cognitedata/cognite-…
polomani File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,4 @@ | ||
from __future__ import annotations | ||
|
||
__version__ = "7.69.2" | ||
__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,49 @@ | ||
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, | ||
) | ||
|
||
if TYPE_CHECKING: | ||
from cognite.client import CogniteClient | ||
|
||
|
||
@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 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 | ||
polomani marked this conversation as resolved.
Show resolved
Hide resolved
|
||
unit: SimulationValueUnitName | None = None | ||
polomani marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
@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 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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the motivation to move this to a separate .py file?
Is it expected to be used with the simulator endpoints?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exactly. there will be many more simint classes added, @lpereiracgn is working on another PR for that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to move this into
/data_classes/simulators/<something>.py
? See for example what we did forhosted_extractors/
. The thinking is that with more resources we start to get overlapping names, so we want to separate them into "namespace" which in python would be different packages.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved