How to modify Run as id for multiple project
Srkanoje
Registered Posts: 32 ✭✭✭✭
Hi all,
is there any script present which can help me modify the run as id for 100 of project in one go.
the exact situation is like within these 100 of project each project might have 2 to 3 scenarios so i want all these to be modified to a particular run as id.
can someone please suggest action on this appreciate your time and efforts.
Thanks !!!
Best Answer
-
Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,211 Dataiker
Hi,
We have an example here on how to re-assigned a scenario runas to another user :
https://doc.dataiku.com/dss/latest/python-api/scenarios.html#reassign-scenarios-to-another-user
To loop trough all project you can do this:
import dataiku client = dataiku.api_client() projects = client.list_projects() for p in projects: project = client.get_project(p["projectKey"]) for scenario in project.list_scenarios(as_type="objects"): settings = scenario.get_settings() if settings.effective_run_as == "u1": print("Scenario %s used to run as u1, reassigning it") # To configure a run_as, we must use the run_as property. # effective_run_as is read-only settings.run_as = "u2" settings.save()
Answers
-
@Alex
thank you this should work