Run Module¶
This section documents the run components of the Nextmv Cloud API.
run
¶
This module contains definitions for an app run.
CLASS | DESCRIPTION |
---|---|
Metadata |
Metadata of a run, whether it was successful or not. |
RunInformation |
Information of a run. |
ErrorLog |
Error log of a run, when it was not successful. |
RunResult |
Result of a run, whether it was successful or not. |
RunLog |
Log of a run. |
FormatInput |
Input format for a run configuration. |
Format |
Format for a run configuration. |
RunType |
The actual type of the run. |
RunTypeConfiguration |
Defines the configuration for the type of the run that is being executed on an application. |
RunQueuing |
RunQueuing configuration for a run. |
RunConfiguration |
Configuration for an app run. |
ExternalRunResult |
Result of a run used to configure a new application run as an external one. |
TrackedRunStatus |
The status of a tracked run. |
TrackedRun |
An external run that is tracked in the Nextmv platform. |
FUNCTION | DESCRIPTION |
---|---|
run_duration |
Calculate the duration of a run in milliseconds. |
ErrorLog
¶
ExternalRunResult
¶
Bases: BaseModel
Result of a run used to configure a new application run as an external one.
You can import the ExternalRunResult
class directly from cloud
:
PARAMETER | DESCRIPTION |
---|---|
|
ID of the output upload. Defaults to None.
TYPE:
|
|
ID of the error upload. Defaults to None.
TYPE:
|
|
Status of the run. Must be "succeeded" or "failed". Defaults to None.
TYPE:
|
|
Error message of the run. Defaults to None.
TYPE:
|
|
Duration of the run, in milliseconds. Defaults to None.
TYPE:
|
error_message
class-attribute
instance-attribute
¶
Error message of the run.
error_upload_id
class-attribute
instance-attribute
¶
ID of the error upload.
execution_duration
class-attribute
instance-attribute
¶
Duration of the run, in milliseconds.
output_upload_id
class-attribute
instance-attribute
¶
ID of the output upload.
Format
¶
Bases: BaseModel
Format for a run configuration.
You can import the Format
class directly from cloud
:
PARAMETER | DESCRIPTION |
---|---|
|
Input format for the run configuration.
TYPE:
|
format_input
class-attribute
instance-attribute
¶
format_input: FormatInput = Field(
serialization_alias="input",
validation_alias=AliasChoices("input", "format_input"),
)
Input format for the run configuration.
FormatInput
¶
Bases: BaseModel
Input format for a run configuration.
You can import the FormatInput
class directly from cloud
:
PARAMETER | DESCRIPTION |
---|---|
|
Type of the input format. Defaults to
TYPE:
|
input_type
class-attribute
instance-attribute
¶
input_type: InputFormat = Field(
serialization_alias="type",
validation_alias=AliasChoices("type", "input_type"),
default=JSON,
)
Type of the input format.
Metadata
¶
Bases: BaseModel
Metadata of a run, whether it was successful or not.
You can import the Metadata
class directly from cloud
:
PARAMETER | DESCRIPTION |
---|---|
|
ID of the application where the run was submitted to.
TYPE:
|
|
ID of the instance where the run was submitted to.
TYPE:
|
|
ID of the version of the application where the run was submitted to.
TYPE:
|
|
Date and time when the run was created.
TYPE:
|
|
Duration of the run in milliseconds.
TYPE:
|
|
Error message if the run failed.
TYPE:
|
|
Size of the input in bytes.
TYPE:
|
|
Size of the output in bytes.
TYPE:
|
|
Deprecated: use status_v2.
TYPE:
|
|
Status of the run.
TYPE:
|
RunConfiguration
¶
Bases: BaseModel
Configuration for an app run.
You can import the RunConfiguration
class directly from cloud
:
PARAMETER | DESCRIPTION |
---|---|
|
Execution class for the instance. Defaults to None.
TYPE:
|
|
Format for the run configuration. Defaults to None.
TYPE:
|
|
Run type configuration for the run. Defaults to None.
TYPE:
|
|
ID of the secrets collection to use for the run. Defaults to None.
TYPE:
|
|
Queuing configuration for the run. Defaults to None.
TYPE:
|
execution_class
class-attribute
instance-attribute
¶
Execution class for the instance.
format
class-attribute
instance-attribute
¶
format: Optional[Format] = None
Format for the run configuration.
queuing
class-attribute
instance-attribute
¶
queuing: Optional[RunQueuing] = None
Queuing configuration for the run.
run_type
class-attribute
instance-attribute
¶
run_type: Optional[RunTypeConfiguration] = None
Run type configuration for the run.
secrets_collection_id
class-attribute
instance-attribute
¶
ID of the secrets collection to use for the run.
RunInformation
¶
Bases: BaseModel
Information of a run.
You can import the RunInformation
class directly from cloud
:
PARAMETER | DESCRIPTION |
---|---|
|
Description of the run.
TYPE:
|
|
ID of the run.
TYPE:
|
|
Metadata of the run.
TYPE:
|
|
Name of the run.
TYPE:
|
|
Email of the user who submitted the run.
TYPE:
|
|
URL to the run in the Nextmv console. Defaults to "".
TYPE:
|
RunLog
¶
RunQueuing
¶
Bases: BaseModel
RunQueuing configuration for a run.
You can import the RunQueuing
class directly from cloud
:
PARAMETER | DESCRIPTION |
---|---|
|
Priority of the run in the queue. 1 is the highest priority, 9 is the lowest priority. Defaults to None.
TYPE:
|
|
Whether the run should be queued, or not. If True, the run will not be queued. If False, the run will be queued. Defaults to None.
TYPE:
|
RunResult
¶
Bases: RunInformation
Result of a run, whether it was successful or not.
You can import the RunResult
class directly from cloud
:
PARAMETER | DESCRIPTION |
---|---|
|
Error log of the run. Only available if the run failed. Defaults to None.
TYPE:
|
|
Output of the run. Only available if the run succeeded. Defaults to None.
TYPE:
|
RunType
¶
RunTypeConfiguration
¶
Bases: BaseModel
Defines the configuration for the type of the run that is being executed on an application.
You can import the RunTypeConfiguration
class directly from cloud
:
PARAMETER | DESCRIPTION |
---|---|
|
Type of the run.
TYPE:
|
|
ID of the definition for the run type. Defaults to None.
TYPE:
|
|
ID of the reference for the run type. Defaults to None.
TYPE:
|
TrackedRun
dataclass
¶
TrackedRun(
input: Union[Input, dict[str, Any], str],
output: Union[Output, dict[str, Any], str],
status: TrackedRunStatus,
duration: Optional[int] = None,
error: Optional[str] = None,
logs: Optional[list[str]] = None,
)
An external run that is tracked in the Nextmv platform.
You can import the TrackedRun
class directly from cloud
:
PARAMETER | DESCRIPTION |
---|---|
|
The input of the run being tracked. Please note that if the input format is JSON, then the input data must be JSON serializable. This field is required.
TYPE:
|
|
The output of the run being tracked. Please note that if the output format is JSON, then the output data must be JSON serializable. This field is required. Only JSON output_format is supported.
TYPE:
|
|
The status of the run being tracked. This field is required.
TYPE:
|
|
The duration of the run being tracked, in milliseconds. This field is optional. Defaults to None.
TYPE:
|
|
An error message if the run failed. You should only specify this if the
run failed (the
TYPE:
|
|
The logs of the run being tracked. Each element of the list is a line in the log. This field is optional. Defaults to None.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the status value is invalid, if an error message is provided for a successful run, or if input/output formats are not JSON or input/output dicts are not JSON serializable. |
duration
class-attribute
instance-attribute
¶
The duration of the run being tracked, in milliseconds.
error
class-attribute
instance-attribute
¶
An error message if the run failed. You should only specify this if the run failed, otherwise an exception will be raised.
input
instance-attribute
¶
The input of the run being tracked.
logs
class-attribute
instance-attribute
¶
The logs of the run being tracked. Each element of the list is a line in the log.
logs_text
¶
Returns the logs as a single string.
Each log entry is separated by a newline character.
RETURNS | DESCRIPTION |
---|---|
str
|
The logs as a single string. If no logs are present, an empty string is returned. |
RAISES | DESCRIPTION |
---|---|
TypeError
|
If |
Source code in nextmv/nextmv/cloud/run.py
output
instance-attribute
¶
The output of the run being tracked. Only JSON output_format is supported.
TrackedRunStatus
¶
run_duration
¶
Calculate the duration of a run in milliseconds.
You can import the run_duration
function directly from cloud
:
PARAMETER | DESCRIPTION |
---|---|
|
The start time of the run. Can be a datetime object or a float representing the start time in seconds since the epoch.
TYPE:
|
|
The end time of the run. Can be a datetime object or a float representing the end time in seconds since the epoch.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
int
|
The duration of the run in milliseconds. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If the start time is after the end time. |
TypeError
|
If start and end are not both datetime objects or both float numbers. |
Examples:
>>> from datetime import datetime, timedelta
>>> start_dt = datetime(2023, 1, 1, 12, 0, 0)
>>> end_dt = datetime(2023, 1, 1, 12, 0, 1)
>>> run_duration(start_dt, end_dt)
1000
>>> start_float = 1672574400.0 # Corresponds to 2023-01-01 12:00:00
>>> end_float = 1672574401.0 # Corresponds to 2023-01-01 12:00:01
>>> run_duration(start_float, end_float)
1000