Run scenarios without run as

UserKp
Level 3
Run scenarios without run as

Hi,

 

I have configured a scenario in Dataiku which is time based trigger to run every 15 seconds,in the run settings there is an option 'Run as" where we can see the list of those who are working in the project and select a name,is there any option to run without that option so that there is no dependency of the person,like it should trigger automatically without using Run as

 

Thanks

0 Kudos
3 Replies
AlexT
Dataiker

Hi @UserKp ,
The Run As will need to either be last_author or an actual user ( only the admin can set a different user to run as)
 
If the concern is that the user leaves you want to avoid the scenario from breaking you can use Python script to change run_as for all scenarios of that  old user as part of of offboarding the user :

import dataiku
client = dataiku.api_client()

old_owner = 'username1'
new_owner = 'username2'

for project_key in client.list_project_keys():
    project = client.get_project(project_key) 
    project_permission = project.get_permissions()
    if project_permission.get('owner') == old_owner:
        print("Changing ownership on project {0}".format(project_key))
        project_permission['owner'] = new_owner 
        project.set_permissions(project_permission)
        

for project_key in client.list_project_keys():
    project = client.get_project(project_key) 
    for scenario in project.list_scenarios(as_type="objects"):
        settings = scenario.get_settings()

        if settings.effective_run_as == old_owner:
            print(f"Scenario used to run as {old_owner}, reassigning it")
            settings.run_as = new_owner
            settings.save()

 

 Kind Regards,

0 Kudos
UserKp
Level 3
Author

so I found this in the docs:

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()

 Now I have configured scenarios to trigger everyday,how can I change its setting from this API?

0 Kudos
Turribeach

If you want to prevent issues with users leaving then create generic scenario runner accounts (basically a user account used for a shared objective) and use those to run your scenarios.

0 Kudos