Skip to content

Add support for simulation runs #2145

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

Merged
merged 21 commits into from
Apr 28, 2025
Merged

Add support for simulation runs #2145

merged 21 commits into from
Apr 28, 2025

Conversation

lpereiracgn
Copy link
Contributor

@lpereiracgn lpereiracgn commented Apr 2, 2025

Description

Every time a simulation routine executes, a simulation run object is created. This object ensures that each execution of a routine is documented and traceable.

Simulation runs provide a historical record of the simulations performed, allowing users to analyze and compare different runs, track changes over time, and make informed decisions based on the simulation results.

Checklist:

  • Tests added/updated.
  • Documentation updated. Documentation is generated from docstrings - these must be updated according to your change.
    If a new method has been added it should be referenced in cognite.rst in order to generate docs based on its docstring.
  • Changelog updated in CHANGELOG.md.
  • Version bumped. If triggering a new release is desired, bump the version number in _version.py and pyproject.toml per semantic versioning.

Copy link

codecov bot commented Apr 2, 2025

Codecov Report

Attention: Patch coverage is 96.33028% with 4 lines in your changes missing coverage. Please review.

Project coverage is 90.59%. Comparing base (56d96c7) to head (e6a1c3c).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
cognite/client/_api/simulators/runs.py 91.89% 3 Missing ⚠️
cognite/client/data_classes/simulators/filters.py 93.75% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2145      +/-   ##
==========================================
+ Coverage   90.53%   90.59%   +0.06%     
==========================================
  Files         158      159       +1     
  Lines       23753    23861     +108     
==========================================
+ Hits        21504    21618     +114     
+ Misses       2249     2243       -6     
Files with missing lines Coverage Δ
cognite/client/_api/simulators/__init__.py 100.00% <100.00%> (ø)
cognite/client/data_classes/simulators/__init__.py 100.00% <100.00%> (ø)
cognite/client/data_classes/simulators/runs.py 100.00% <100.00%> (ø)
cognite/client/testing.py 100.00% <100.00%> (ø)
cognite/client/data_classes/simulators/filters.py 98.03% <93.75%> (-1.97%) ⬇️
cognite/client/_api/simulators/runs.py 91.89% <91.89%> (ø)

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lpereiracgn lpereiracgn changed the title Simulator runs endpoint Add support for simulation runs Apr 2, 2025
@lpereiracgn lpereiracgn marked this pull request as ready for review April 8, 2025 08:08
@lpereiracgn lpereiracgn requested review from a team as code owners April 8, 2025 08:08
polomani
polomani previously approved these changes Apr 8, 2025
Copy link
Contributor

@polomani polomani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, needs the code owner review

Copy link
Contributor

@doctrino doctrino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main comment is how to deal with creating a SimulationRun by routine and by routine revision.

@overload
def create(self, run: Sequence[SimulationRunWrite]) -> SimulatorRunsList: ...

def create(self, run: SimulationRunWrite | Sequence[SimulationRunWrite]) -> SimulationRun | SimulatorRunsList:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How to you plan to add support for create by routine reversion. It seems you only have by routine now
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since it's a feature, can it be a separate PR? we are over 500 limit already

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expected it to be a separate PR, but I was wondering if these two will have a shared base class which will have consequences for this PR. However, as this is alpha we can do a breaking change later if necessary, so approving for now.

@doctrino doctrino self-requested a review April 24, 2025 14:03
@lpereiracgn lpereiracgn requested a review from a team April 24, 2025 14:11
@lpereiracgn
Copy link
Contributor Author

Information for risk-reviewers: The tests failing in this PR have nothing to do with the changes introduced.
The fix for the tests is being addressed here: #2150

Copy link
Contributor

@psalaberria002 psalaberria002 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦄

@lpereiracgn lpereiracgn added this pull request to the merge queue Apr 28, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 28, 2025
@evertoncolling evertoncolling added this pull request to the merge queue Apr 28, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 28, 2025
@lpereiracgn lpereiracgn added this pull request to the merge queue Apr 28, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 28, 2025
@lpereiracgn lpereiracgn added this pull request to the merge queue Apr 28, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 28, 2025
@lpereiracgn lpereiracgn added this pull request to the merge queue Apr 28, 2025
Merged via the queue into master with commit 3cb3c79 Apr 28, 2025
31 checks passed
@lpereiracgn lpereiracgn deleted the simulator-runs-endpoint branch April 28, 2025 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants