Run object
The Run
object comes with three sets of methods: CRUD methods, generic run methods and (eventual) kind specific methods.
CRUD methods
Crud methods are used to interact with the entity object in the backend or locally.
save()
: Save or update the entity into the backend.export()
: Export the entity locally as yaml file.refresh()
: Refresh (read) the entity from the backend.
save
Save or update the entity into the backend.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
update
|
bool
|
Flag to indicate update. |
False
|
Returns:
Type | Description |
---|---|
ContextEntity
|
Entity saved. |
export
Export object as a YAML file in the context folder.
Returns:
Type | Description |
---|---|
str
|
Exported filepath. |
refresh
Refresh object from backend.
Returns:
Type | Description |
---|---|
ContextEntity
|
Entity refreshed. |
Run methods
There are several generic run methods on the Run
object.
wait
: Wait for the run to finish.stop
: Stop the run.resume
: Resume the run.log_metric
: Log a metric in the run.
wait
Wait for run to finish.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
log_info
|
bool
|
If True, log information. |
True
|
Returns:
Type | Description |
---|---|
Run
|
Run object. |
stop
Stop run.
Returns:
Type | Description |
---|---|
None
|
|
resume
Resume run.
Returns:
Type | Description |
---|---|
None
|
|
log_metric
Log metric into entity status. A metric is named by a key and value (single number or list of numbers). The metric by default is put in a list or appended to an existing list. If single_value is True, the value will be a single number.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
str
|
Key of the metric. |
required |
value
|
MetricType
|
Value of the metric. |
required |
overwrite
|
bool
|
If True, overwrite existing metric. |
False
|
single_value
|
bool
|
If True, value is a single value. |
False
|
Returns:
Type | Description |
---|---|
None
|
|
Examples:
Log a new value in a list
Append a new value in a list
Log a list of values and append them to existing metric:
Log a single value (not represented as list):
Log a list of values and overwrite existing metric:
Kind specific methods
Kind specific methods are used to express potential behaviors of different object kinds. See the kinds section for more information.