Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
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
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,
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,
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.