The api.objects.Run
class¶
Inherits from ABC
> SimvueObject
Class for directly interacting with/creating runs on the server.
Methods¶
__init__(...)¶
Initialise a Run. If an identifier is provided a connection will be made to the object matching the identifier on the target server. Else a new Run will be created using arguments provided in kwargs.
Parameters
identifier | str | None |
= None |
the remote server unique id for the target run |
kwargs | dict |
any additional arguments to be passed to the object initialiser |
abort(...)¶
Trigger an abort for this run by notifying the server.
Parameters
reason | str |
description of the reason for this abort. |
Returns
dict[str, Any]
server response after updating abort status.
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()¶
Delete the server entry for this object.
Returns
dict[str, Any]
response from server on deletion.
get(...)¶
Get runs from the server.
Parameters
count | Optional[Annotated[int, Gt(gt=0)]] |
= None |
limit the number of objects returned, default no limit. |
offset | Optional[Annotated[int, Ge(ge=0)]] |
= None |
start index for results, default is 0. |
sorting | list[simvue.api.objects.run.RunSort] | None |
= None |
list of sorting definitions in the form {'column': str, 'descending': bool} |
Yields
tuple[str, Run]
id of run Run object representing object on server
get_alert_details()¶
Retrieve the full details of alerts for this run.
Yields
dict[str, Any]
alert details for each alert within this run.
Returns
Generator[dict[str, Any], None, None]
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.
new(...)¶
Create a new Run on the Simvue server.
Parameters
folder | Annotated[str, FieldInfo(annotation=None, required=True, metadata=[_PydanticGeneralMetadata(pattern='^/.*')])] |
folder to contain this run |
|
offline | bool |
= False |
create the run in offline mode, default False. |
Returns
Run
run object with staged changes
on_reconnect(...)¶
Executed when a run switches from offline to online mode.
Parameters
id_mapping | dict[str, str] |
A mapping from offline identifier 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.
send_heartbeat()¶
to_dict()¶
Convert object to serializable dictionary.
Returns
dict[str, Any]
dictionary representation of this object
Properties¶
abort_trigger¶
Returns
bool
the current state of the abort trigger
alerts¶
Set/retrieve a list of alert IDs for this run.
Returns
list[str]
artifacts¶
Retrieve the artifacts for this run.
Returns
list[dict[str, Any]]
the artifacts associated with this run
created¶
Set/retrieve created datetime for the run.
Returns
datetime.datetime
description¶
Set/retrieve the description for this run.
Returns
str
endtime¶
Set/retrieve endtime datetime for the run.
Returns
datetime.datetime
events¶
Yields
tuple[str, dict[str, Any]]
event from this run
Returns
Generator[tuple[str, dict[str, Any]]
folder¶
Set/retrieve the folder associated with this run.
Returns
str
heartbeat_timeout¶
Set/retrieve the timeout for the heartbeat of this run.
Returns
int | None
id¶
The identifier for this object if applicable.
Returns
str | None
metadata¶
Set/retrieve the metadata for this run.
Returns
dict[str, Any]
metrics¶
Retrieve metrics for this run from the server.
Yields
tuple[str, dict[str, int | float | bool]]
metric values for this run
Returns
Generator[tuple[str, dict[str, int | float | bool]]
name¶
Set/retrieve name associated with this run.
Returns
str
notifications¶
Set/retrieve the notification state.
Returns
"none" | "all" | "error" | "lost"
runtime¶
Retrieve execution time for the run
staged¶
Return currently staged changes to this object.
Returns
dict[str, Any] | None
the locally staged data if available.
started¶
Set/retrieve started datetime for the run.
Returns
datetime.datetime
status¶
Set/retrieve the run status.
Returns
"lost" | "failed" | "completed" | "terminated" | "running" | "created"
system¶
Set/retrieve the system metadata for this run.
Returns
dict[str, Any]
tags¶
Set/retrieve the tags associated with this run.
Returns
list[str]
ttl¶
Set/retrieve the retention period for this run.
Returns
int
url¶
The URL for accessing this object on the server.
Returns
simvue.api.url.URL | None