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_suuid String No * SUUID of the job you want to run
name String No Give the run a name
descriptoin String No Add a description to the run info
data Dictionary No JSON data containg an optional payload for the run
job_name String No * Name of the job you want to 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

General parameters
Name Type Required Description
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.
number_of_result Integer No The number of runs in the result. Defaults to 100.
order_by String No Sets the ordering of the run list. Defaults to "-created_at"
search String No Search for a specific run
Filter parameters
Name Type Required Description
created_by_suuid String No SUUID of the member who started the run
created_by_suuid__exclude String No Exclude runs started by this member SUUID
job_name String No Name of the job from which you want to get the runs
job_suuid String No SUUID of the job from which you want to get the runs
job_suuid__exclude String No Exclude runs with this job SUUID
package_suuid String No SUUID of the package from which you want to get runs
package_suuid__exclude String No Exclude runs with this package SUUID
project_suuid String No SUUID of the project from which you want to get the runs
project_suuid__exclude String No Exclude runs with this project SUUID
run_suuid_list List No List of SUUIDs of the runs you want to get the runinfo from
run_suuid__exclude String No Exclude runs with this run SUUID
status String No Filter the runs by status
status__exclude String No Filter the runs by excluding status
trigger String No Filter the runs by trigger
trigger__exclude String No Filter the runs by excluding trigger
workspace_suuid String No SUUID of the workspace from which you want to get the runs
workspace_suuid__exclude String No Exclude runs with this workspace SUUID

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 of 100 results.

Output

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

askanna.run.get_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.get_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.result_content_type

import askanna

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

Parameters

Name Type Required Description
run_suuid String No SUUID of the run you want to get the result content type 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 result of that run. If there is no "active" run, the SDK will raise an ValueError with No run SUUID set.

Output

string with the result content type

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 run 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