Scenario reporters - run under specific condition

Solved!
tomas
Level 5
Scenario reporters - run under specific condition
Hi,

I have a question about how to send conditionally messages from scenario (Warnings for example). Usually a scenario finishes the step(s) all right, but from time to time a warning condition appears and I want to report it, but only then, not after every run.

Now I do this that way, that I set the exit value of the step to 1, so it appears as Failed, and then set run condition is outcome != 'SUCCESS'. So this way I receive notification only when warning happens, and I customize the info message. But it does not looks good in the scenario history, where the whole run is reported as failed.

Is it possible to finish the step normally with SUCCESS outcome, but trigger only the reporter condition when the python script evaluates that a message needs to be sent?

Thanks
0 Kudos
1 Solution
fchataigner2
Dataiker

Hi,



since the part producing the warning is a Python script (or step), you can in this Python script save a value in the scenario variables, and use that variable in the condition for the reporter. Indeed, the "outcome" variable used in the condition for reporters is only an example. All variables available to the scenario can be accessed there.



With:




from dataiku.scenario import Scenario
Scenario().set_scenario_variables(foo='bar')


You can use a condition:




foo == 'bar'


Regards,



    Frederic

View solution in original post

0 Kudos
3 Replies
fchataigner2
Dataiker

Hi,



since the part producing the warning is a Python script (or step), you can in this Python script save a value in the scenario variables, and use that variable in the condition for the reporter. Indeed, the "outcome" variable used in the condition for reporters is only an example. All variables available to the scenario can be accessed there.



With:




from dataiku.scenario import Scenario
Scenario().set_scenario_variables(foo='bar')


You can use a condition:




foo == 'bar'


Regards,



    Frederic

0 Kudos
Ashenn1
Level 1

Hi Frederic,

 

I have been looking for a solution for this problem and wasted a lot of time, I looked everywhere in the Dataiku  documentation version 6.0 for this snippet of code but couldn't find it anywhere.

It'd be really helpful if you could you share where you got it from because apparently i haven't been looking in the right place.

 

Thanks.

0 Kudos
niko
Level 1
0 Kudos