Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
We are using Dataiku Version 8.My requirement is whoever runs the Scenario, the Scenario has to run with their name as Owner to pass the current executing user id to underlying recipes to process dynamic logic.
I tried using below script in the same scenario but it is still taking the scenario owner name only.
for scenario in p.list_scenarios(as_type="objects"):
settings = scenario.get_settings()
if scenario == "Custom Python Scenario":
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 = int(cuser)
Please suggest if any option to achieve this
Operating system used: RHEL 7.9
Havent done this exact thing but just sharing a few things you can check incase you dont get a full solution from anyone else.
Do your users have the rights to change the RUN_AS option manually ?
One of the things we had noticed was that the RUN_AS option could only be changed by Admin roles.
If thats the case for you as well you might want to consider creating a Macro, and use an Admin Client for your API calls.
Also not sure if you can change the runas in the same scenario . so please check if it works when you call the function from another scenario
Thanks for your response. Yes you are right,Later I realised that and also tried from another scenario to change the scenario run_as but no luck. It seems some limitation in using that method in version 8.
Regarding the privilege's I will check further and identify which roles/access can change the owner of the scenario.
I don't think its possible to do this without being an administrator. May be you can try getting the current authenticated user instead of getting a scenario user.
auth_info = client.get_auth_info() # auth_info is a dict which contains at least a "authIdentifier" field, which is the login for a user print("User running this code is %s" % auth_info["authIdentifier"])