Scenario with parameters

Options
Alan_Fusté
Alan_Fusté Partner, Registered Posts: 43 Partner
Hello,

I've found in the documentation that I can execute scenario with parameters (https://doc.dataiku.com/dss/latest/python-api/rest-api-client/scenarios.html) doing something like scenario.run({'x': y}) but is there a way to run a scenario from another scenario sending execution parameters (in my case, a date)?



Thank you

Best Answer

  • Mattsco
    Mattsco Administrator, Dataiker Posts: 125 Administrator
    Answer ✓
    Options

    Hi,

    I would use project variables.

    In your case, I would set the variables of project A to {"x":y} and run scenario of project A from project B.

    You can use the python client to do that in a python step of a scenario:

    import dataiku

    client = dataiku.api_client()

    p = client.get_project(PROJECT_A)

    variables = p.get_variables()

    variables["standard"] = {"x":y}

    p.set_variables(variables)

    Doc about project variables:

    https://doc.dataiku.com/dss/latest/advanced/variables_expansion.html

Answers

  • Alan_Fusté
    Alan_Fusté Partner, Registered Posts: 43 Partner
    Options
    Ok, I'll try your solution! Thanks Mattsco!
  • Vinothkumar
    Vinothkumar Registered Posts: 17 ✭✭✭✭
    Options

    Hi Mattsco,Fuste,

    Looking for one additional information.

    Lets say, in my scenario, the first step is updating the variable.

    variable name is: "Name"

    So i want to run the next step only if the variable "Name" is not equal to "NA".

    So in scenario, in the second step,

    Run this step->"If condition is satisficed"

    And added this condition

    ${Name} !="NA"

    Is this correct way? But my scenario is not going to the 2nd step irrespective of the variable(when it is NA,when it is not NA)

    Could you able to help me?

    I would like to run my 2nd step only when i get the proper "Name".If it is NA, i dont want to run next step.

    Thanks,

    Vinothkumar M

Setup Info
    Tags
      Help me…