Skip to content

Python SDK - Run

Run a job

askanna.run.start

import askanna

askanna.run.start(job_name="{NAME_OF_THE_JOB}")

# or use the unique job SUUID:
askanna.run.start(job_suuid="{JOB_SUUID}")

Parameters

Name Type Required Description
job_name String No Name of the job you want to run.
job_suuid String No SUUID of the job you want to run.
data Dictionary No JSON data containg an optional payload for the run
project_suuid String No Project SUUID of the project for which you want to run a job.

To be able to start a run, we need either the job_name or the job_suuid.

Output

Dataclass: RunStatus

askanna.run.status

import askanna

status = askanna.run.status(run_suuid="{RUN_SUUID}")
print(status)

Parameters

Name Type Required Description
run_suuid String No SUUID of the run you want to get the status from

run_suuid not provided

If the run_suuid is not provided, the SDK will check if you started a run in the active session and will get the status of that run. If there is no "active" run, the SDK will raise an ValueError with No run SUUID set.

Output

Dataclass: RunStatus

Get run data

askanna.run.get

import askanna

run = askanna.run.get(run_suuid="{RUN_SUUID}")

Parameters

Name Type Required Description
run_suuid String No Run SUUID of the run you want to get the run info from
include_metrics Boolean No Should the output include the metrics, or not. Default value: False
include_variables Boolean No Should the output include the variables, or not. Default value: False

run_suuid not provided

If the run_suuid is not provided, the SDK will check if you started a run in the active session and will get the info of that run. If there is no "active" run, the SDK will raise an ValueError with No run SUUID set.

Output

Dataclass: Run & optionally metrics and variables values

askanna.run.list

import askanna

run_list = askanna.run.list(run_suuid_list=["{RUN_SUUID_1}", "{RUN_SUUID_2}"])

Parameters

Name Type Required Description
run_suuid_list List No List of SUUIDs of the runs you want to get the runinfo from
project_suuid String No Project SUUID of the project from which you want to get the runs
job_suuid String No Job SUUID of the job from which you want to get the runs
job_name String No Job name of the job from which you want to get the runs
include_metrics Boolean No Include the run metrics in the Run dataclass. Defaults to False.
include_variables Boolean No Include the run variables in the Run dataclass. Defaults to False.
limit Integer No Limit the number of runs in the result. Defaults to 100.
offset Integer No Offset the number of runs in the result. Defaults to 0.
ordering String No Sets the ordering of the run list. Defaults to "-created"

Return all results

When the paramters run_suuid_list, project_suuid, job_suuid and job_name are left blank, the function will return all runs with a default limit of 100.

Output

A list with Dataclass: Run objects & optionally metrics and variables values

askanna.run.metric

import askanna

run_metrics = askanna.run.get_metric(run_suuid="{RUN_SUUID}")

Parameters

Name Type Required Description
run_suuid String No Run SUUID of the run from which you want to get the metrics

run_suuid not provided

If the run_suuid is not provided, the SDK will check if you started a run in the active session and will get the metrics of that run. If there is no "active" run, the SDK will raise an ValueError with No run SUUID set.

Output

Dataclass: MetricList

On this list it's possible to get a single object, or to filter multiple objects:

run_metrics.get(name="{METRIC_NAME}") # get a single object

run_metrics.filter(name="{METRIC_NAME}") # filter multiple objects

askanna.run.variable

import askanna

run_variables = askanna.run.get_variable(run_suuid="{RUN_SUUID}")

Parameters

Name Type Required Description
run_suuid String No Run SUUID of the run from which you want to get the variables

run_suuid not provided

If the run_suuid is not provided, the SDK will check if you started a run in the active session and will get the variables of that run. If there is no "active" run, the SDK will raise an ValueError with No run SUUID set.

Output

Dataclass: VariableList

On this list it's possible to get a single object, or to filter multiple objects:

run_variables.get(name="{VARIABLE_NAME}") # get a single object

run_variables.filter(name="{VARIABLE_NAME}") # filter multiple objects

askanna.run.result

import askanna

result = askanna.run.result(run_suuid="{RUN_SUUID}")

Parameters

Name Type Required Description
run_suuid String No SUUID of the run you want to get the result from
output_path Path or String No Path to save the result to. Default is None, which means the function will return the result content.

run_suuid not provided

If the run_suuid is not provided, the SDK will check if you started a run in the active session and will get the result of that run. If there is no "active" run, the SDK will raise an ValueError with No run SUUID set.

Output

If output_path is None the output is the result content, which is of type bytes.

If output_path is set, then the output is the result saved at the output_path and the function returns None.

askanna.run.artifact

import askanna

artifact = askanna.run.artifact(run_suuid="{RUN_SUUID}")

Parameters

Name Type Required Description
run_suuid String No SUUID of the run you want to get the artifact from
output_path Path or String No Path to save the artifact to. Default is None, which means the function will return the artifact content.

run_suuid not provided

If the run_suuid is not provided, the SDK will check if you started a run in the active session and will get the artifact of that run. If there is no "active" run, the SDK will raise an ValueError with No run SUUID set.

Output

If output_path is None the output is the artifact content, which is of type bytes.

If output_path is set, then the output is the artifact saved at the output_path and the function returns None.

askanna.run.artifact_info

import askanna

artifact_info = askanna.run.artifact_info(run_suuid="{RUN_SUUID}")

Parameters

Name Type Required Description
run_suuid String No SUUID of the run you want to get the artifact info from

run_suuid not provided

If the run_suuid is not provided, the SDK will check if you started a run in the active session and will get the artifact info of that run. If there is no "active" run, the SDK will raise an ValueError with No run SUUID set.

Output

Dataclass: ArtifactInfo

askanna.run.payload

import askanna

artifact = askanna.run.payload(run_suuid="{RUN_SUUID}")

Parameters

Name Type Required Description
run_suuid String No SUUID of the run you want to get the payload from
output_path Path or String No Path to save the artifact to. Default is None, which means the function will return the artifact content.

run_suuid not provided

If the run_suuid is not provided, the SDK will check if you started a run in the active session and will get the payload of that run. If there is no "active" run, the SDK will raise an ValueError with No run SUUID set.

Output

If output_path is None the output is the payload content, which is of type bytes.

If output_path is set, then the output is the payload saved at the output_path and the function returns None.

askanna.run.payload_info

import askanna

payload_info = askanna.run.payload_info(run_suuid="{RUN_SUUID}")

Parameters

Name Type Required Description
run_suuid String No SUUID of the run you want to get the payload info from

run_suuid not provided

If the run_suuid is not provided, the SDK will check if you started a run in the active session and will get the payload info of that run. If there is no "active" run, the SDK will raise an ValueError with No run SUUID set.

Output

Dataclass: Payload

askanna.run.log

import askanna

log = askanna.run.log(run_suuid="{RUN_SUUID}")

Parameters

Name Type Required Description
run_suuid String No SUUID of the run you want to get the log from

run_suuid not provided

If the run_suuid is not provided, the SDK will check if you started a run in the active session and will get the log of that run. If there is no "active" run, the SDK will raise an ValueError with No run SUUID set.

Output

A list with log rows

Change run info

askanna.run.change

import askanna

run = askanna.run.change(run_suuid="{RUN_SUUID}", name="{NEW_NAME}")

Parameters

Name Type Required Description
run_suuid String No Run SUUID of the run you want to change the run info for
name String No New name for the run. Defaults to None (do not change).
description String No New description of the run. Defaults to None (do not change).

To change run info, at least we need a new name or description

run_suuid not provided

If the run_suuid is not provided, the SDK will check if you started a run in the active session and will change the info of that run. If there is no "active" run, the SDK will raise an ValueError with No run SUUID set.

Output

Dataclass: Run

Delete a run

askanna.run.delete

import askanna

run = askanna.run.delete(run_suuid="{RUN_SUUID}")

Parameters

Name Type Required Description
run_suuid String No Run SUUID of the run you want to delete

run_suuid not provided

If the run_suuid is not provided, the SDK will check if you started a run in the active session and will delete that run. If there is no "active" run, the SDK will raise an ValueError with No run SUUID set.

Output

Bool: True if the run is succesfully deleted