Community Conundrum 28: News Engagement is live! Read More

How to use the output of a Custom Python Step in another Scenario Step

Level 1
How to use the output of a Custom Python Step in another Scenario Step

Hello,

I am currently parametrizing a scenario in which i try to launch a 'Build/Train Step' if a condition is satisfied. The condition i am trying to implement is based on the result of the previous Step which is a 'Custom Python Step'.

Until now, when i am launching my scenario, the condition is never verified and so the BCapture_scenario_problem.JPGuild/Train Step never works.

Does someone now how to use the output of a Custom Python Step in my Build/Train Step ?

Thank you in advance.

0 Kudos
4 Replies
Dataiker
Dataiker

You can use:

stepResults.getPath(".['customPythonStep1'].outcome").arrayContains("SUCCESS")

With FAILED, WARNING being the other 2 possible outcomes

Note that step output and step results are slightly different. Step outputs are only availables on steps which provide one (for ex: the execute SQL step puts the results of the SQL query. as output)

Level 1
Author

In fact, "OK" is the result of a function which is in the Custom Python Step. My purpose is getting the result of these function and not getting the state of the Step (SUCCESS, WARNING, FAILED)

0 Kudos
Neuron
Neuron

Hi @Remi_Mathieu,

You may already be setting a scenario variable in your Execute Python step but just in case here is how to do that:

from dataiku.scenario import Scenario
Scenario().set_scenario_variables(pythonStepResult='OK')

This topic by @tomas describes how to set a step condition to check the value of a variable: https://community.dataiku.com/t5/Using-Dataiku-DSS/How-to-use-variables-in-the-Scenario-step-conditi...

Turns out to be very simple - just use the variable name directly: pythonStepResult == 'OK'

Marlan

Level 1
Author

Thanks you for your response. It works very well on my case.

0 Kudos
A banner prompting to get Dataiku DSS