Skip to content

Commit eb38356

Browse files
committed
Merge branch 'v2.1'
2 parents 28d4e8c + 976b8f2 commit eb38356

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2873
-1638
lines changed

.github/workflows/test_client_ubuntu.yml

Lines changed: 111 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,95 @@ concurrency:
1818
cancel-in-progress: true
1919

2020
jobs:
21-
build:
22-
21+
online_unit_tests:
22+
runs-on: ubuntu-latest
23+
timeout-minutes: 40
24+
steps:
25+
- uses: actions/checkout@v4
26+
- name: Set up Python 3.13
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: "3.13"
30+
- name: Install dependencies
31+
run: |
32+
python -m pip install poetry
33+
poetry self add poetry-plugin-export
34+
poetry export -f requirements.txt --with dev -o requirements.txt --all-extras
35+
python -m pip install torch --index-url https://download.pytorch.org/whl/cpu
36+
python -m pip install -r requirements.txt
37+
python -m pip install .
38+
- name: Test with pytest
39+
env:
40+
SIMVUE_URL: ${{ secrets.SIMVUE_URL }}
41+
SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }}
42+
run: python -m pytest tests/unit/ -x -m online -c /dev/null -p no:warnings -n 0 -v
43+
offline_unit_tests:
44+
runs-on: ubuntu-latest
45+
timeout-minutes: 40
46+
steps:
47+
- uses: actions/checkout@v4
48+
- name: Set up Python 3.13
49+
uses: actions/setup-python@v5
50+
with:
51+
python-version: "3.13"
52+
- name: Install dependencies
53+
run: |
54+
python -m pip install poetry
55+
poetry self add poetry-plugin-export
56+
poetry export -f requirements.txt --with dev -o requirements.txt --all-extras
57+
python -m pip install torch --index-url https://download.pytorch.org/whl/cpu
58+
python -m pip install -r requirements.txt
59+
python -m pip install .
60+
- name: Test with pytest
61+
env:
62+
SIMVUE_URL: ${{ secrets.SIMVUE_URL }}
63+
SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }}
64+
run: python -m pytest tests/unit/ -x -m offline -c /dev/null -p no:warnings -n 0 -v
65+
online_functional_tests:
66+
runs-on: ubuntu-latest
67+
timeout-minutes: 40
68+
steps:
69+
- uses: actions/checkout@v4
70+
- name: Set up Python 3.13
71+
uses: actions/setup-python@v5
72+
with:
73+
python-version: "3.13"
74+
- name: Install dependencies
75+
run: |
76+
python -m pip install poetry
77+
poetry self add poetry-plugin-export
78+
poetry export -f requirements.txt --with dev -o requirements.txt --all-extras
79+
python -m pip install torch --index-url https://download.pytorch.org/whl/cpu
80+
python -m pip install -r requirements.txt
81+
python -m pip install .
82+
- name: Test with pytest
83+
env:
84+
SIMVUE_URL: ${{ secrets.SIMVUE_URL }}
85+
SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }}
86+
run: python -m pytest tests/functional/ -x -m online -c /dev/null -p no:warnings -n 0 -v
87+
offline_functional_tests:
88+
runs-on: ubuntu-latest
89+
timeout-minutes: 40
90+
steps:
91+
- uses: actions/checkout@v4
92+
- name: Set up Python 3.13
93+
uses: actions/setup-python@v5
94+
with:
95+
python-version: "3.13"
96+
- name: Install dependencies
97+
run: |
98+
python -m pip install poetry
99+
poetry self add poetry-plugin-export
100+
poetry export -f requirements.txt --with dev -o requirements.txt --all-extras
101+
python -m pip install torch --index-url https://download.pytorch.org/whl/cpu
102+
python -m pip install -r requirements.txt
103+
python -m pip install .
104+
- name: Test with pytest
105+
env:
106+
SIMVUE_URL: ${{ secrets.SIMVUE_URL }}
107+
SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }}
108+
run: python -m pytest tests/functional/ -x -m offline -c /dev/null -p no:warnings -n 0 -v
109+
other_unit_tests:
23110
runs-on: ubuntu-latest
24111
timeout-minutes: 40
25112
steps:
@@ -40,9 +127,26 @@ jobs:
40127
env:
41128
SIMVUE_URL: ${{ secrets.SIMVUE_URL }}
42129
SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }}
43-
run: python -m pytest tests/ -x --cov --cov-report=xml -m 'not scenario' -c /dev/null -p no:warnings -n 0 -v
44-
- name: Upload coverage reports to Codecov
130+
run: python -m pytest tests/unit/ -x -m 'not offline' -m 'not online' -m 'not scenario' -c /dev/null -p no:warnings -n 0 -v
131+
other_functional_tests:
132+
runs-on: ubuntu-latest
133+
timeout-minutes: 40
134+
steps:
135+
- uses: actions/checkout@v4
136+
- name: Set up Python 3.13
137+
uses: actions/setup-python@v5
138+
with:
139+
python-version: "3.13"
140+
- name: Install dependencies
45141
run: |
46-
curl -Os https://uploader.codecov.io/latest/linux/codecov
47-
chmod +x codecov
48-
./codecov -t ${CODECOV_TOKEN}
142+
python -m pip install poetry
143+
poetry self add poetry-plugin-export
144+
poetry export -f requirements.txt --with dev -o requirements.txt --all-extras
145+
python -m pip install torch --index-url https://download.pytorch.org/whl/cpu
146+
python -m pip install -r requirements.txt
147+
python -m pip install .
148+
- name: Test with pytest
149+
env:
150+
SIMVUE_URL: ${{ secrets.SIMVUE_URL }}
151+
SIMVUE_TOKEN: ${{ secrets.SIMVUE_TOKEN }}
152+
run: python -m pytest tests/functional/ -x -m 'not offline' -m 'not online' -m 'not scenario' -c /dev/null -p no:warnings -n 0 -v

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ repos:
2323
args: [--branch, main, --branch, dev]
2424
- id: check-added-large-files
2525
- repo: https://github.com/astral-sh/ruff-pre-commit
26-
rev: v0.9.9
26+
rev: v0.11.2
2727
hooks:
2828
- id: ruff
2929
args: [ --fix, --exit-non-zero-on-fix, "--ignore=C901" ]

CHANGELOG.md

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change log
2-
2+
## [v2.1.0](https://github.com/simvue-io/client/releases/tag/v2.1.0) - 2025-03-28
3+
* Removed CodeCarbon dependence in favour of a slimmer solution using the CO2 Signal API.
4+
* Added sorting to server queries, users can now specify to sort by columns during data retrieval from the database.
5+
* Added pagination of results from server to reduce await time in responses.
6+
* Added equivalent of folder details modification function to `Client` class.
7+
## [v2.0.1](https://github.com/simvue-io/client/releases/tag/v2.0.1) - 2025-03-24
8+
* Improvements to docstrings on methods, classes and functions.
39
## [v2.0.0](https://github.com/simvue-io/client/releases/tag/v2.0.0) - 2025-03-07
410
* Add new example notebooks
511
* Update and refactor examples to work with v2.0
@@ -51,28 +57,28 @@
5157
* Adds additional functionality and support for offline mode.
5258
* Support for Simvue servers `>=3`.
5359

54-
## [v1.1.4](https://github.com/simvue-io/client/releases/tag/v1.1.4) - 2024-12-11
60+
## [v1.1.4](https://github.com/simvue-io/python-api/releases/tag/v1.1.4) - 2024-12-11
5561

5662
* Remove incorrect identifier reference for latest Simvue servers during reconnection.
5763
* Fixed missing online mode selection when retrieving configuration for `Client` class.
5864

59-
## [v1.1.3](https://github.com/simvue-io/client/releases/tag/v1.1.3) - 2024-12-09
65+
## [v1.1.3](https://github.com/simvue-io/python-api/releases/tag/v1.1.3) - 2024-12-09
6066

6167
* Fixed bug with `requirements.txt` metadata read.
6268
* Added Simvue server version check.
6369
* Remove checking of server version in offline mode and add default run mode to configuration options.
6470
* Fix offline mode class initialisation, and propagation of configuration.
6571

66-
## [v1.1.2](https://github.com/simvue-io/client/releases/tag/v1.1.2) - 2024-11-06
72+
## [v1.1.2](https://github.com/simvue-io/python-api/releases/tag/v1.1.2) - 2024-11-06
6773

6874
* Fix bug in offline mode directory retrieval.
6975

70-
## [v1.1.1](https://github.com/simvue-io/client/releases/tag/v1.1.1) - 2024-10-22
76+
## [v1.1.1](https://github.com/simvue-io/python-api/releases/tag/v1.1.1) - 2024-10-22
7177

7278
* Add missing `offline.cache` key to TOML config.
7379
* Fix repetition of server URL validation for each call to configuration.
7480

75-
## [v1.1.0](https://github.com/simvue-io/client/releases/tag/v1.1.0) - 2024-10-21
81+
## [v1.1.0](https://github.com/simvue-io/python-api/releases/tag/v1.1.0) - 2024-10-21
7682

7783
* Add option to specify a callback executed when an alert is triggered for a run.
7884
* Allow retrieval of all alerts when no constraints are specified.
@@ -83,35 +89,35 @@
8389
* Indicate the source used for token and URL.
8490
* Migrate to `simvue.toml` from `simvue.ini`, allowing more defaults to be set during runs.
8591

86-
## [v1.0.6](https://github.com/simvue-io/client/releases/tag/v1.0.6) - 2024-10-10
92+
## [v1.0.6](https://github.com/simvue-io/python-api/releases/tag/v1.0.6) - 2024-10-10
8793

8894
* Fix incorrect usage of `retry` when attempting connections to the server.
8995

90-
## [v1.0.5](https://github.com/simvue-io/client/releases/tag/v1.0.5) - 2024-10-09
96+
## [v1.0.5](https://github.com/simvue-io/python-api/releases/tag/v1.0.5) - 2024-10-09
9197

9298
* Ensure all functionality is deactivated when mode is set to `disabled`.
9399
* When an exception is thrown an event is sent to Simvue displaying the traceback.
94100
* If `add_process` is used and an exception is thrown, `.err` and `.out` files are still uploaded.
95101

96-
## [v1.0.4](https://github.com/simvue-io/client/releases/tag/v1.0.4) - 2024-09-24
102+
## [v1.0.4](https://github.com/simvue-io/python-api/releases/tag/v1.0.4) - 2024-09-24
97103

98104
* Set resource metrics to be recorded by default.
99105

100-
## [v1.0.3](https://github.com/simvue-io/client/releases/tag/v1.0.3) - 2024-09-23
106+
## [v1.0.3](https://github.com/simvue-io/python-api/releases/tag/v1.0.3) - 2024-09-23
101107

102108
* Fix issue of hanging threads when exception raised by script using the API.
103109

104-
## [v1.0.2](https://github.com/simvue-io/client/releases/tag/v1.0.2) - 2024-08-21
110+
## [v1.0.2](https://github.com/simvue-io/python-api/releases/tag/v1.0.2) - 2024-08-21
105111

106112
* Fix incorrect HTTP status code in `Client` when checking if object exists.
107113
* Fix issue with `running=False` when launching a `Run` caused by incorrect system metadata being sent to the server.
108114

109-
## [v1.0.1](https://github.com/simvue-io/client/releases/tag/v1.0.1) - 2024-07-16
115+
## [v1.0.1](https://github.com/simvue-io/python-api/releases/tag/v1.0.1) - 2024-07-16
110116

111117
* Fix to `add_process` with list of strings as arguments, the executable no longer returns the string `"None"`.
112118
* Fix callbacks and triggers for `add_process` being executed only on `Run` class termination, not on process completion.
113119

114-
## [v1.0.0](https://github.com/simvue-io/client/releases/tag/v1.0.0) - 2024-06-14
120+
## [v1.0.0](https://github.com/simvue-io/python-api/releases/tag/v1.0.0) - 2024-06-14
115121

116122
* Refactor and re-write of codebase to align with latest developments in version 2 of the Simvue server.
117123
* Added `Executor` to Simvue runs allowing users to start shell based processes as part of a run and handle termination of these.
@@ -121,119 +127,119 @@
121127
* Fixed issue whereby metrics would still have to wait for the next iteration of dispatch before being sent to the server, even if the queue was not full.
122128
* Added support for `'user'` alerts.
123129

124-
## [v0.14.3](https://github.com/simvue-io/client/releases/tag/v0.14.3) - 2023-06-29
130+
## [v0.14.3](https://github.com/simvue-io/python-api/releases/tag/v0.14.3) - 2023-06-29
125131

126132
* Ensure import of the `requests` module is only done if actually used.
127133

128-
## [v0.14.0](https://github.com/simvue-io/client/releases/tag/v0.14.0) - 2023-04-04
134+
## [v0.14.0](https://github.com/simvue-io/python-api/releases/tag/v0.14.0) - 2023-04-04
129135

130136
* Added a method to the `Client` class for retrieving events.
131137

132-
## [v0.13.3](https://github.com/simvue-io/client/releases/tag/v0.13.3) - 2023-04-04
138+
## [v0.13.3](https://github.com/simvue-io/python-api/releases/tag/v0.13.3) - 2023-04-04
133139

134140
* Allow files (`input` and `code` only) to be saved for runs in the `created` state.
135141
* Allow metadata and tags to be updated for runs in the `created` state.
136142

137-
## [v0.13.2](https://github.com/simvue-io/client/releases/tag/v0.13.2) - 2023-04-04
143+
## [v0.13.2](https://github.com/simvue-io/python-api/releases/tag/v0.13.2) - 2023-04-04
138144

139145
* Added `plot_metrics` method to the `Client` class to simplify plotting metrics.
140146
* (Bug fix) `reconnect` works without a uuid being specified when `offline` mode isn't being used.
141147
* (Bug fix) Restrict version of Pydantic to prevent v2 from accidentally being used.
142148

143-
## [v0.13.1](https://github.com/simvue-io/client/releases/tag/v0.13.1) - 2023-03-28
149+
## [v0.13.1](https://github.com/simvue-io/python-api/releases/tag/v0.13.1) - 2023-03-28
144150

145151
* Set `sample_by` to 0 by default (no sampling) in `get_metrics_multiple`.
146152

147-
## [v0.13.0](https://github.com/simvue-io/client/releases/tag/v0.13.0) - 2023-03-28
153+
## [v0.13.0](https://github.com/simvue-io/python-api/releases/tag/v0.13.0) - 2023-03-28
148154

149155
* Added methods to the `Client` class for retrieving metrics.
150156
* CPU architecture and processor obtained on Apple hardware.
151157
* Client now reports to server when files have been successfully uploaded.
152158
* `User-Agent` header now included in HTTP requests.
153159

154-
## [v0.12.0](https://github.com/simvue-io/client/releases/tag/v0.12.0) - 2023-03-13
160+
## [v0.12.0](https://github.com/simvue-io/python-api/releases/tag/v0.12.0) - 2023-03-13
155161

156162
* Add methods to the `Client` class for deleting runs and folders.
157163
* Confusing messages about `process no longer exists` or `NVML Shared Library Not Found` no longer displayed.
158164

159-
## [v0.11.4](https://github.com/simvue-io/client/releases/tag/v0.11.4) - 2023-03-13
165+
## [v0.11.4](https://github.com/simvue-io/python-api/releases/tag/v0.11.4) - 2023-03-13
160166

161167
* (Bug fix) Ensure `simvue_sender` can be run when installed from PyPI.
162168
* (Bug fix) Runs created in `offline` mode using a context manager weren't automatically closed.
163169

164-
## [v0.11.3](https://github.com/simvue-io/client/releases/tag/v0.11.3) - 2023-03-07
170+
## [v0.11.3](https://github.com/simvue-io/python-api/releases/tag/v0.11.3) - 2023-03-07
165171

166172
* Added logging messages for debugging when debug level set to `debug`.
167173

168-
## [v0.11.2](https://github.com/simvue-io/client/releases/tag/v0.11.2) - 2023-03-06
174+
## [v0.11.2](https://github.com/simvue-io/python-api/releases/tag/v0.11.2) - 2023-03-06
169175

170176
* Raise exceptions in `Client` class methods if run does not exist or artifact does not exist.
171177
* (Bug fix) `list_artifacts` optional category restriction now works.
172178

173-
## [v0.11.1](https://github.com/simvue-io/client/releases/tag/v0.11.1) - 2023-03-05
179+
## [v0.11.1](https://github.com/simvue-io/python-api/releases/tag/v0.11.1) - 2023-03-05
174180

175181
* Support different runs having different metadata in `get_runs` dataframe output.
176182
* (Bug fix) Error message when creating a duplicate run is now more clear.
177183
* (Bug fix) Correction to stopping the worker thread in situations where the run never started.
178184

179-
## [v0.11.0](https://github.com/simvue-io/client/releases/tag/v0.11.0) - 2023-03-04
185+
## [v0.11.0](https://github.com/simvue-io/python-api/releases/tag/v0.11.0) - 2023-03-04
180186

181187
* Support optional dataframe output from `get_runs`.
182188

183-
## [v0.10.1](https://github.com/simvue-io/client/releases/tag/v0.10.1) - 2023-03-03
189+
## [v0.10.1](https://github.com/simvue-io/python-api/releases/tag/v0.10.1) - 2023-03-03
184190

185191
* The worker process now no longer gives a long delay when a run has finished (now at most ~1 second).
186192
* The worker process ends when the `Run()` context ends or `close` is called, rather than only when the main process exits.
187193

188-
## [v0.10.0](https://github.com/simvue-io/client/releases/tag/v0.10.0) - 2023-02-07
194+
## [v0.10.0](https://github.com/simvue-io/python-api/releases/tag/v0.10.0) - 2023-02-07
189195

190196
* The `client` class can now be used to retrieve runs.
191197

192-
## [v0.9.1](https://github.com/simvue-io/client/releases/tag/v0.9.1) - 2023-01-25
198+
## [v0.9.1](https://github.com/simvue-io/python-api/releases/tag/v0.9.1) - 2023-01-25
193199

194200
* (Bug fix) Retries in POST/PUTs to REST APIs didn't happen.
195201
* Warn users if `allow_pickle=True` is required.
196202

197-
## [v0.9.0](https://github.com/simvue-io/client/releases/tag/v0.9.0) - 2023-01-25
203+
## [v0.9.0](https://github.com/simvue-io/python-api/releases/tag/v0.9.0) - 2023-01-25
198204

199205
* Set status to `failed` or `terminated` if the context manager is used and there is an exception.
200206

201-
## [v0.8.0](https://github.com/simvue-io/client/releases/tag/v0.8.0) - 2023-01-23
207+
## [v0.8.0](https://github.com/simvue-io/python-api/releases/tag/v0.8.0) - 2023-01-23
202208

203209
* Support NumPy arrays, PyTorch tensors, Matplotlib and Plotly plots and picklable Python objects as artifacts.
204210
* (Bug fix) Events in offline mode didn't work.
205211

206-
## [v0.7.2](https://github.com/simvue-io/client/releases/tag/v0.7.2) - 2023-01-08
212+
## [v0.7.2](https://github.com/simvue-io/python-api/releases/tag/v0.7.2) - 2023-01-08
207213

208214
* Pydantic model is used for input validation.
209215
* Support NaN, -inf and inf in metadata and metrics.
210216

211-
## [v0.7.0](https://github.com/simvue-io/client/releases/tag/v0.7.0) - 2022-12-05
217+
## [v0.7.0](https://github.com/simvue-io/python-api/releases/tag/v0.7.0) - 2022-12-05
212218

213219
* Collect CPU, GPU and memory resource metrics.
214220
* Automatically delete temporary files used in offline mode once runs have entered a terminal state.
215221
* Warn users if their access token has expired.
216222
* Remove dependency on the randomname module, instead handle name generation server side.
217223

218-
## [v0.6.0](https://github.com/simvue-io/client/releases/tag/v0.6.0) - 2022-11-07
224+
## [v0.6.0](https://github.com/simvue-io/python-api/releases/tag/v0.6.0) - 2022-11-07
219225

220226
* `offline` and `disabled` options replaced with single `mode` flag.
221227

222-
## [v0.5.0](https://github.com/simvue-io/client/releases/tag/v0.5.0) - 2022-11-03
228+
## [v0.5.0](https://github.com/simvue-io/python-api/releases/tag/v0.5.0) - 2022-11-03
223229

224230
* Added option to disable all monitoring.
225231

226-
## [v0.4.0](https://github.com/simvue-io/client/releases/tag/v0.4.0) - 2022-11-03
232+
## [v0.4.0](https://github.com/simvue-io/python-api/releases/tag/v0.4.0) - 2022-11-03
227233

228234
* Offline mode added, enabling tracking of simulations running on worker nodes without outgoing network access.
229235
* Argument to `init` enabling runs to be left in the `created` state changed from `status="created"` to `running=True`.
230236
* Improvements to error handling.
231237

232-
## [v0.3.0](https://github.com/simvue-io/client/releases/tag/v0.3.0) - 2022-10-31
238+
## [v0.3.0](https://github.com/simvue-io/python-api/releases/tag/v0.3.0) - 2022-10-31
233239

234240
* Update `add_alert` method to support either metrics or events based alerts.
235241

236-
## [v0.2.0](https://github.com/simvue-io/client/releases/tag/v0.2.0) - 2022-10-26
242+
## [v0.2.0](https://github.com/simvue-io/python-api/releases/tag/v0.2.0) - 2022-10-26
237243

238244
* The previous `Simvue` class has been split into `Run` and `Client`. When creating a run use the new `Run` class rather than `Simvue`.
239245

0 commit comments

Comments
 (0)