Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

## Unreleased

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

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

Expand Down
18 changes: 16 additions & 2 deletions simvue/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,12 @@ def get_runs(
filters: list[str] | None,
*,
system: bool = False,
attributes: list[str] | None = None,
metadata: bool = False,
metrics: bool = False,
alerts: bool = False,
metadata: bool = False,
system_info: bool = False,
timing_info: bool = False,
output_format: typing.Literal["dict", "objects", "dataframe"] = "objects",
count_limit: pydantic.PositiveInt | None = 100,
start_index: pydantic.NonNegativeInt = 0,
Expand All @@ -202,6 +205,9 @@ def get_runs(
filters: list[str] | None
set of filters to apply to query results. If None is specified
return all results without filtering.
attributes : list[str] | None, optional
specify specific attributes to retrieve for runs.
Default of None includes all.
metadata : bool, optional
whether to include metadata information in the response.
Default False.
Expand All @@ -211,6 +217,12 @@ def get_runs(
alerts : bool, optional
whether to include alert information in the response.
Default False.
system_info : bool, optional
whether to include system information in the response.
Default False.
timing_info: bool, optional
whether to include timing information in the response.
Default False.
output_format : Literal['dict', objects', 'dataframe'], optional
the structure of the response
* dict - dictionary of values.
Expand Down Expand Up @@ -252,11 +264,13 @@ def get_runs(
_runs = Run.get(
count=count_limit,
offset=start_index,
attributes=json.dumps(attributes),
filters=json.dumps(filters),
return_basic=True,
return_system=system_info,
return_timing=timing_info,
return_metrics=metrics,
return_alerts=alerts,
return_system=system,
return_metadata=metadata,
sorting=[dict(zip(("column", "descending"), a)) for a in sort_by_columns]
if sort_by_columns
Expand Down
25 changes: 17 additions & 8 deletions tests/functional/test_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from logging import critical
import pytest
import uuid
import random
Expand All @@ -8,8 +7,6 @@
import pathlib
import time

import requests
import pytest_mock
import tempfile
import simvue.client as svc
from simvue.exception import ObjectNotFoundError
Expand Down Expand Up @@ -226,23 +223,35 @@ def test_get_artifacts_as_files(
@pytest.mark.client
@pytest.mark.object_retrieval
@pytest.mark.parametrize(
"output_format,sorting",
"output_format,sorting,system_info,timing_info,metrics,metadata,alerts,attributes",
[
("dict", None),
("dataframe", [("created", True), ("started", True)]),
("objects", [("metadata.test_identifier", True)]),
("dict", None, False, True, False, True, False, ["test_engine"]),
("dataframe", [("created", True), ("started", True)], True, False, True, False, True, None),
("objects", [("metadata.test_identifier", True)], False, False, False, False, False, None),
],
ids=("dict-unsorted", "dataframe-datesorted", "objects-metasorted"),
)
def test_get_runs(
create_test_run: tuple[sv_run.Run, dict],
output_format: str,
sorting: list[tuple[str, bool]] | None,
system_info: bool,
timing_info: bool,
metrics: bool,
metadata: bool,
alerts: bool,
attributes: list[str] | None
) -> None:
client = svc.Client()

_result = client.get_runs(
filters=[], output_format=output_format, count_limit=10, sort_by_columns=sorting
filters=[],
output_format=output_format,
count_limit=10,
sort_by_columns=sorting,
timing_info=True,
system_info=True,
attributes=attributes
)

if output_format == "dataframe":
Expand Down