Skip to content

The api.objects.Metrics class

Inherits from ABC > SimvueObject

Class for retrieving metrics stored on the server.

Methods

__init__()

Initialise a Metrics object instance.


commit()

Send updates to the server, or if offline, store locally.


count()

Return the total number of entries for this object type from the server.

Returns

int

total from server database for current user.


delete()

Metrics cannot be deleted


get(...)

Retrieve metrics from the server for a given set of runs.

Parameters
metrics list[str] name of metrics to retrieve.
xaxis Literal['timestamp', 'step', 'time'] the x-axis type
step - enumeration.
time - time in seconds.
timestamp - time stamp.
runs list[str] list of runs to return metrics for.
count Optional[Annotated[int, Gt(gt=0)]] = None limit result count.
offset Optional[Annotated[int, Gt(gt=0)]] = None index offset for count.

Yields

dict[str, dict[str, list[dict[str, float]]]

metric set object containing metrics for run.


ids(...)

Retrieve a list of all object identifiers.

Parameters
count int | None = None limit number of objects
offset int | None = None set start index for objects list

Yields

str

identifiers for all objects of this type.


names()


new(...)

Create a new Metrics entry on the Simvue server.

Parameters
run str identifier for the run to attach metrics to.
metrics list[simvue.models.MetricSet] set of metrics to attach to run.
offline bool = False whether to create in offline mode, default is False.

Returns

Metrics

metrics object


on_reconnect(...)

Action performed when mode switched from offline to online.

Parameters
id_mapping dict[str, str] mapping from offline to online identifier.

read_only(...)

Set whether this object is in read only state.

Parameters
is_read_only bool whether object is read only.

refresh()

Refresh staging from local data if in read-only mode.


span()


to_dict()

Convert metrics object to dictionary.

Returns

dict[str, Any]

dictionary representation of metrics object.


Properties

id

The identifier for this object if applicable.

Returns

str | None


staged

Return currently staged changes to this object.

Returns

dict[str, Any] | None

the locally staged data if available.


url

The URL for accessing this object on the server.

Returns

simvue.api.url.URL | None