Run#
Graviti SDK use class Run
to represent an action run. The run
number
is used as the unique identifier of an action.
Action run is a action level resource, it is necessary to get an action first:
from graviti import Workspace
ws = Workspace(f"{YOUR_ACCESSKEY}")
dataset = ws.datasets.get(f"{DATASET_NAME}")
action = dataset.actions.get(f"{ACTION_NAME}")
Create an Action Run#
“Create an Action Run” is equivalent to “Run an Action”.
SDK provides method create()
to create an action run:
# Run an action with the default arguments:
action.runs.create()
# Run an action with given arguments:
action.runs.create({f"{ARGUMENT_NAME}": f"{ARGUMENT_VALUE}"})
List Action Runs#
SDK provides method list()
to list action runs:
action.runs.list()
Get an Action Run#
SDK provides method get()
to get an action run:
action.runs.get(f"{RUN_NUMBER}")
Cancel an Action Run#
SDK provides method Run.cancel()
to cancel an action
run:
run = action.runs.get(f"{RUN_NUMBER}")
run.cancel()
Get the Run Log#
Get the log of an action run is not supported directly in SDK so far. The log can be get from the
Graviti webpage which url can be found in the property Run.url
.
run = action.runs.get(f"{RUN_NUMBER}")
print(run.url)