Dataiku scenario
![mahesh_s](https://us.v-cdn.net/6038231/uploads/Dataiku/nAvatar24.png)
Hi everyone,
I created a scenario that runs on hourly basis. Now if scenarios fails for any reason I want to deactivate auto trigger so it won't run until I troubleshoot the failure.
Is there any easy way of doing this through the visual interface?
Best Answer
-
Hi mahesh_s,
I think a good way to handle your use case would be to add a custom Python step (in the Add step dropdown, Code > Execute Python code) at the end of your scenario, with Run this step set on the If a prior step failed option.
To unset the auto-trigger field of your scenario, you could for instance use the snippet below, filling YOUR_PROJECT_KEY and YOUR_SCENARIO_ID with the proper values:
from dataiku import api_client project = api_client().get_project(YOUR_PROJECT_KEY) scenario_settings = project.get_scenario(YOUR_SCENARIO_ID).get_settings() scenario_settings.active = False scenario_settings.save()
Hope this helps,
Agathe
Answers
-
Hi Agathe, Thanks. Your solution has worked for me.
-
cbimou Partner, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 12 Partner
Hi @AgatheG
,How can i process if i want to use multiple host in my code please?
Here is the context: I used a python script that runs a scenario on a single dataiku instance and it works.
I would now like to use the same scenario pointing to two dataiku differents instances at the same time.
To do this, I have added the info of both instances (see the code) but the code returns only the results of the first instance. I would like it to go around the instances and give me the results.Here is the code I use. Could you please help me to solve this problem?
import sys
import ConfigParser
import logging
import dataikuapi
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
# Define the connections
# get project host and api key
# Designer node of dev
designer_host = "host a"
designer_api_key = "key a"
# Designer node of qualif
designer_q_host = "host b"
designer_q_api_key = "key b"
# initializing client
client = dataikuapi.DSSClient(host=['designer_host','designer_q_host'], api_key=['designer_q_host','designer_q_api_key'])
client._session.verify = False
# get all project keys
project_keys = client.list_project_keys()
print(project_keys)
# iterating through all the projects keys
for p in project_keys:
# getting the project as the object type
project = client.get_project(p)
# iterating through all the scenarios within the project
for scenario in project.list_scenarios(as_type="objects"
print("In %s project, running a scenario %s..." % (p, scenario.id))
try:
scenario.run_and_wait()
print("...finished successfully")
print("--------------------------------------")
except:
print("...finished with errors. Check the logs for more details")
print("--------------------------------------")Thanks in advance
-
Hi cbimou,
I think your problem comes from this line:
# initializing client client = dataikuapi.DSSClient(host=['designer_host','designer_q_host'], api_key=['designer_q_host','designer_q_api_key'])
If I remember correctly, the parameters host and api_key should be strings, not lists. You should have one DSSClient per instance.
That being said, if this does not answer your issue and we need to elaborate further, please create a new post. This post is quite older and has been answered, and your current issue is not directly related.
Hope that helps!
Agathe