Continue custom python scenario script if error is encountered

Options
sylvyr3
sylvyr3 Registered Posts: 21 ✭✭✭✭
edited July 16 in Using Dataiku

Hi,

When building a scenario using the sequence of steps option, it's possible to select ignore failure for 'Run another scenario' step. Is there a way to ignore failure in the custom python scenario script?

In the below example, "scenario.run_scenario('Test_Tables_Databases')" will run a scenario that will fail because it is executing scenario.execute_sql() on a table that doesn't exist (for test purposes). Once that scenario fails then the current scenario will stop. Is there a way to run my custom python scenario script without stopping if a failure is encountered?

import dataiku
from dataikuapi.dss.scenario import DSSScenario
from dataiku.scenario import Scenario

client = dataiku.api_client()
scenario = Scenario()

# Run the scenario that checks each table for database locks
scenario.run_scenario('Test_Tables_Databases')

dss_scenario_test = DSSScenario(client, dataiku.default_project_key(), "Test_Tables_Databases")

# Check if 'test' scenario succeeded or failed
outcome = dss_scenario_test.get_last_runs()[0].get_info()['result']['outcome']

if outcome == 'SUCCESS':

scenario.run_scenario('Build_Final_Dataset')

#elif outcome == 'FAILED':

Best Answer

Answers

Setup Info
    Tags
      Help me…