Run scenarios without run as

UserKp
UserKp Registered Posts: 20

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

Answers

  • Alexandru
    Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,212 Dataiker
    edited July 17

    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,

  • UserKp
    UserKp Registered Posts: 20
    edited July 17

    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?

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 1,982 Neuron

    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.

Setup Info
    Tags
      Help me…