Discover this year's submissions to the Dataiku Frontrunner Awards and give kudos to your favorite use cases and success stories!READ MORE

Trigger a scenario when project variables change?

Solved!
info-rchitect
Level 5
Trigger a scenario when project variables change?

Hi,

 

I have a JSON hash stored as a project variable.  Is there a way to trigger a scenario based on whether this variable changes? 

 

thx


Operating system used: Windows 10

0 Kudos
1 Solution
AlexT
Dataiker
Dataiker

Hi,

There is no built-in trigger currently. You can use a custom python trigger every 30 minutes let's say.

It would check the variable value and store another variable e.g  last_value_read_by_scenario_trigger.

Then after each run, you would update the variable "var_last_read" and if this is different then the variable you would trigger the scenario. 

Let me know if that works for you.

from dataiku.scenario import Trigger
t = Trigger()
import dataiku

project_handle = dataiku.api_client().get_project(dataiku.default_project_key())
vars = project_handle.get_variables()

if vars['standard']['varname'] != vars['standard']['var_last_read']:
    vars['standard']['var_last_read'] = vars['standard']['varname']
    project_handle.set_variables(vars)
    t.fire()

 

Kind Regards,

View solution in original post

2 Replies
AlexT
Dataiker
Dataiker

Hi,

There is no built-in trigger currently. You can use a custom python trigger every 30 minutes let's say.

It would check the variable value and store another variable e.g  last_value_read_by_scenario_trigger.

Then after each run, you would update the variable "var_last_read" and if this is different then the variable you would trigger the scenario. 

Let me know if that works for you.

from dataiku.scenario import Trigger
t = Trigger()
import dataiku

project_handle = dataiku.api_client().get_project(dataiku.default_project_key())
vars = project_handle.get_variables()

if vars['standard']['varname'] != vars['standard']['var_last_read']:
    vars['standard']['var_last_read'] = vars['standard']['varname']
    project_handle.set_variables(vars)
    t.fire()

 

Kind Regards,

info-rchitect
Level 5
Author

thx @AlexT , I do something similar to your solution.  I do think adding a trigger condition based on a project variable changes would be a good enhancement.

0 Kudos