Skip to content

Commit 47a5cd3

Browse files
authored
Merge pull request #838 from simvue-io/kzscisoft/822-support-for-explicitly-requesting-run-attributes
✨ Added additional result refinement terms to get_runs
2 parents a341fae + 0f2c24a commit 47a5cd3

File tree

3 files changed

+35
-11
lines changed

3 files changed

+35
-11
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
## Unreleased
44

5-
- Improve handling of Conda based environments in metadata collection.
5+
- Improves handling of Conda based environments in metadata collection.
6+
- Adds additional options to `Client.get_runs`.
67

78
## [v2.1.2](https://github.com/simvue-io/client/releases/tag/v2.1.2) - 2025-06-25
89

simvue/client.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,12 @@ def get_runs(
186186
filters: list[str] | None,
187187
*,
188188
system: bool = False,
189+
attributes: list[str] | None = None,
190+
metadata: bool = False,
189191
metrics: bool = False,
190192
alerts: bool = False,
191-
metadata: bool = False,
193+
system_info: bool = False,
194+
timing_info: bool = False,
192195
output_format: typing.Literal["dict", "objects", "dataframe"] = "objects",
193196
count_limit: pydantic.PositiveInt | None = 100,
194197
start_index: pydantic.NonNegativeInt = 0,
@@ -202,6 +205,9 @@ def get_runs(
202205
filters: list[str] | None
203206
set of filters to apply to query results. If None is specified
204207
return all results without filtering.
208+
attributes : list[str] | None, optional
209+
specify specific attributes to retrieve for runs.
210+
Default of None includes all.
205211
metadata : bool, optional
206212
whether to include metadata information in the response.
207213
Default False.
@@ -211,6 +217,12 @@ def get_runs(
211217
alerts : bool, optional
212218
whether to include alert information in the response.
213219
Default False.
220+
system_info : bool, optional
221+
whether to include system information in the response.
222+
Default False.
223+
timing_info: bool, optional
224+
whether to include timing information in the response.
225+
Default False.
214226
output_format : Literal['dict', objects', 'dataframe'], optional
215227
the structure of the response
216228
* dict - dictionary of values.
@@ -252,11 +264,13 @@ def get_runs(
252264
_runs = Run.get(
253265
count=count_limit,
254266
offset=start_index,
267+
attributes=json.dumps(attributes),
255268
filters=json.dumps(filters),
256269
return_basic=True,
270+
return_system=system_info,
271+
return_timing=timing_info,
257272
return_metrics=metrics,
258273
return_alerts=alerts,
259-
return_system=system,
260274
return_metadata=metadata,
261275
sorting=[dict(zip(("column", "descending"), a)) for a in sort_by_columns]
262276
if sort_by_columns

tests/functional/test_client.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from logging import critical
21
import pytest
32
import uuid
43
import random
@@ -8,8 +7,6 @@
87
import pathlib
98
import time
109

11-
import requests
12-
import pytest_mock
1310
import tempfile
1411
import simvue.client as svc
1512
from simvue.exception import ObjectNotFoundError
@@ -226,23 +223,35 @@ def test_get_artifacts_as_files(
226223
@pytest.mark.client
227224
@pytest.mark.object_retrieval
228225
@pytest.mark.parametrize(
229-
"output_format,sorting",
226+
"output_format,sorting,system_info,timing_info,metrics,metadata,alerts,attributes",
230227
[
231-
("dict", None),
232-
("dataframe", [("created", True), ("started", True)]),
233-
("objects", [("metadata.test_identifier", True)]),
228+
("dict", None, False, True, False, True, False, ["test_engine"]),
229+
("dataframe", [("created", True), ("started", True)], True, False, True, False, True, None),
230+
("objects", [("metadata.test_identifier", True)], False, False, False, False, False, None),
234231
],
235232
ids=("dict-unsorted", "dataframe-datesorted", "objects-metasorted"),
236233
)
237234
def test_get_runs(
238235
create_test_run: tuple[sv_run.Run, dict],
239236
output_format: str,
240237
sorting: list[tuple[str, bool]] | None,
238+
system_info: bool,
239+
timing_info: bool,
240+
metrics: bool,
241+
metadata: bool,
242+
alerts: bool,
243+
attributes: list[str] | None
241244
) -> None:
242245
client = svc.Client()
243246

244247
_result = client.get_runs(
245-
filters=[], output_format=output_format, count_limit=10, sort_by_columns=sorting
248+
filters=[],
249+
output_format=output_format,
250+
count_limit=10,
251+
sort_by_columns=sorting,
252+
timing_info=True,
253+
system_info=True,
254+
attributes=attributes
246255
)
247256

248257
if output_format == "dataframe":

0 commit comments

Comments
 (0)