diff --git a/CHANGELOG.md b/CHANGELOG.md index 1eb91a4e..1dedd210 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/simvue/client.py b/simvue/client.py index 1d129e03..8944bafc 100644 --- a/simvue/client.py +++ b/simvue/client.py @@ -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, @@ -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. @@ -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. @@ -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 diff --git a/tests/functional/test_client.py b/tests/functional/test_client.py index 966821e7..40a83130 100644 --- a/tests/functional/test_client.py +++ b/tests/functional/test_client.py @@ -1,4 +1,3 @@ -from logging import critical import pytest import uuid import random @@ -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 @@ -226,11 +223,11 @@ 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"), ) @@ -238,11 +235,23 @@ 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":