dataiku global project variable update is not taken into account in python continuous recipe

Luc
Luc Registered Posts: 1 ✭✭✭

Hi,

I am trying to control a python continuous recipe with the test of a global project variable.

I have tried this:



response = requests.get(url, headers=headers, stream=True)

if response.status_code == 200:
for line in response.iter_lines():
# create a project handle
project = dataiku.Project()
variables = project.get_variables()
stop_cmd = variables["standard"]["stop_cmd"] if stop_cmd == "True": # Stop the recipe

I first run the recipe with "stop_cmd" equals to "False", then during the execution I would like to stop the recipe by changing value to "True"
It appears that "stop_cmd" value is not seen as updated with the new value, even if I force the variables retrieval in the loop.

What's wrong ?

thanks

Answers

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,090 Neuron

    Can you try using this code to get the project handle?

    import dataiku
    client = dataiku.api_client()
    project = client.get_default_project()
    

    The rest should be the same.

Setup Info
    Tags
      Help me…