Calling scenario from another scenario and creating a new step
s-cordo
Registered Posts: 6 ✭✭✭✭
Hi Dataiku Community,
In my use case, I've got 3 scenarios (scenario A, scenario B, scenario C) and one 'main' scenario that calls those scenarios. All of those scenarios are 'Custom Python code' scenarios.
Basically, my 'main' scenario looks like :
import dataiku from dataiku.scenario import Scenario main_scenario = Scenario() project_key = dataiku.get_custom_variables()['projectKey'] scenario_ids = ['scenario_A', 'scenario_B', 'scenario_C'] for scenario_id in scenario_ids: scenario.run_scenario(scenario_id ,project_key=project_key ,asynchronous=False ,fail_fatal=True )
Scenarios are well triggered and are defined as step inside my 'main' scenario
However, I did not succeed in passing parameters to the called scenario using the scenario.run_scenario() function. So I used the scenario API just as below :
import dataiku from dataiku import api_client from dataiku.scenario import Scenario main_scenario = Scenario() project_key = dataiku.get_custom_variables()['projectKey'] project = dataiku.api_client().get_project(project_key) scenario_ids = ['SCENARIO_A', 'SCENARIO_B', 'SCENARIO_C'] for scenario_id in scenario_ids: scenario = project.get_scenario(scenario_id) params_to_send = { "param1" : "var1" } scenario.run_and_wait(params = params_to_send)
My scenarios are well-triggered with parameters, but scenarios are not a step anymore inside my Main scenario. Scenario details are empty :
So, here are my questions :
- When using scenario.run_scenario() function, is it possible to pass parameters to the called scenario ?
- If not, when using scenario.run_and_wait() function, is it possible to consider the scenario called as a step just like scenario.run_scenario() function does ?
- More globally, and I thinks it's related to this post , is it possible to create custom step when creating a custom python scenario ? It could avoid to have empty Details section and to have to go to the logs...
Or maybe existing a function to print relevant information in the Details section without creating a step.
Thanks for your help
Sylvain
Tagged: