Managing scenarios¶
Reference documentation¶
-
class
dataikuapi.dss.scenario.
DSSScenario
(client, project_key, id)¶ A handle to interact with a scenario on the DSS instance
-
abort
()¶ Aborts the scenario if it currently running
-
run
(params={})¶ Requests a run of the scenario, which will start after a few seconds.
Params dict params: additional parameters that will be passed to the scenario through trigger params
-
get_trigger_fire
(trigger_id, trigger_run_id)¶ Requests a trigger of the run of a scenario
- Args:
- trigger_id: Id of trigger trigger_run_id: Id of the run of the trigger
- Returns:
- A
dataikuapi.dss.admin.DSSTriggerFire
trigger handle
-
run_and_wait
(params={}, no_fail=False)¶ Requests a run of the scenario, which will start after a few seconds. Wait the end of the run to complete.
- Args:
- params: additional parameters that will be passed to the scenario through trigger params
- Returns:
- A
dataikuapi.dss.admin.DSSScenarioRun
run handle
-
get_last_runs
(limit=10, only_finished_runs=False)¶ Get the list of the last runs of the scenario.
Returns: A list of dataikuapi.dss.scenario.DSSScenarioRun
-
get_current_run
()¶ Get the current run of the scenario, or None if it is not running at the moment
Returns: A dataikuapi.dss.scenario.DSSScenarioRun
-
get_run
(run_id)¶ Get a handle to a run of the scenario
Returns: A dataikuapi.dss.scenario.DSSScenarioRun
-
get_definition
(with_status=True)¶ Returns the definition of the scenario
- Args:
- with_status: if True, the definition contains the run status of the scenario but not its
- actions’ definition. If False, the definition doesn’t contain the run status but has the scenario’s actions definition
-
set_definition
(definition, with_status=True)¶ Updates the definition of this scenario
- Args:
- with_status: should be the same as the value passed to get_definition(). If True, the params,
- triggers and reporters fields of the scenario are ignored,
-
get_payload
(extension='py')¶ Returns the payload of the scenario
Parameters: extension (str) – the type of script. Default is ‘py’ for python
-
set_payload
(script, with_status=True)¶ Updates the payload of this scenario
Parameters: extension (str) – the type of script. Default is ‘py’ for python
-
get_average_duration
(limit=3)¶ Get the average duration (in fractional seconds) of the last runs of this scenario that finished, where finished means it ended with SUCCESS or WARNING. If there are not enough runs to perform the average, returns None
- Args:
- limit: number of last runs to average on
-
-
class
dataikuapi.dss.scenario.
DSSScenarioRun
(client, run)¶ A handle containing basic info about a past run of a scenario.
This handle can also be used to fetch additional information about the urn
-
get_info
()¶ Get the basic information of the scenario run
-
get_details
()¶ Get the full details of the scenario run, including its step runs.
Note: this perform another API call
-
get_start_time
()¶ Get the start time of the scenario run
-
get_duration
()¶ Get the duration of this run (in fractional seconds).
If the run is still running, get the duration since it started
-
-
class
dataikuapi.dss.scenario.
DSSScenarioRunWaiter
(scenario_run, trigger_fire)¶ Helper to wait for a job’s completion
-
wait
(no_fail=False)¶
-
-
class
dataikuapi.dss.scenario.
DSSTriggerFire
(scenario, trigger_fire)¶ The activation of a trigger on the DSS instance
-
get_scenario_run
()¶ Get the run of the scenario that this trigger activation launched
-
is_cancelled
(refresh=False)¶ Whether the trigger has been cancelled
Parameters: refresh – get the state of the trigger from the backend
-
wait_for_scenario_run
(no_fail=False)¶
-