Passing arguments between scenarios

Srini_E Registered Posts: 14


I have a case where I need to pass arguments/variables from a scenario (scenario_A) to another scenario (scenario_B). Scenario_B will be executed after scenario_A is completed, some outputs from scenario_A will be used in scenario_B, is there any option to pass these values?

Thanks in advance!


Best Answer

  • nmadhu20
    nmadhu20 Neuron, Registered, Neuron 2022, Neuron 2023 Posts: 35 Neuron
    Answer ✓

    Hey @Srini_E

    For you to be able to pass the value of parameters from one scenario to another, you'd need to store it somewhere. The easiest approach is what @kathyqingyuxu
    mentioned as 'project variables' which gives you the added advantage of monitoring the values as well.

    However, there is one more approach. You can set Scenario variables via your code and access them in scenario B.

    Step 1 - Set scenario variables in scenario A

    scenario = Scenario()

    scenario.set_scenario_variables(file_path = 'file_path', confidence_threshold = 'confidence_threshold', aws_keys = 'aws_keys')

    Step 2 - Access these variables from Scenario B

    import dataiku

    client = dataiku.api_client()

    project = client.get_project(‘PROJECT_NAME')

    scenario = project.get_scenario(‘SCENARIO_A’)

    parameter_value = scenario.get_last_finished_run().get_details()['scenarioRun']['variables'] #returns a json

    Hope this helps!



  • kathyqingyuxu
    kathyqingyuxu Neuron, Registered, Neuron 2022 Posts: 46 Neuron

    Hey @Srini_E

    Any chance you can elaborate on what kind of values you're looking to pass to scenario B from scenario A?

    If you can store the values in a dataset that might make the most sense (i.e. final output of scenario A generates data to a dataset on the flow, then use that final dataset output from scenario A as input to processes in scenario B).

    Or store your values/arguments in a Dataiku project level variable:Variables in Flows, Webapps, and Dataiku Applications — Dataiku Knowledge Base.

    Hope this helps!



  • Srini_E
    Srini_E Registered Posts: 14

    Hi @kathyqingyuxu

    Thank you for your response!

    My actual use case is a chain trigger of scenarios one after other once an API call triggers scenario_A where in the API call business will provide these params: filepaths (for all scenarios (A, B, C, etc)), confidence_threshold, AWS_secret keys. This API can utilized by any business within our organization by providing their params. We want to create something we do not want to make edits in dataiku project level variables every-time. We just want to use in API call.

    API call ---> Scenario_A ---> Scenario_B -----> Scenario_C ........

    Hope this explains better.

Setup Info
      Help me…