Admin API

abdulmalik1
abdulmalik1 Registered Posts: 1

Hi,

I'd asking about Jobs section in the following page "/admin/monitoring/background-tasks" , how I can getting this data using HTTP API or python API.

Tagged:

Answers

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

    Hi @abdulmalik1
    ,

    There is no public API for "background-tasks" specifically. We've taken note of this feature request.

    Note list_futures() API will return running tasks with the exclusion of scenarios, jobs, and notebooks. This generally captures "other running tasks", specifically webapp backends and code studios.

    From what I understand, what you want is a "list_running_jobs(") API. This currently does not exist, and the only way to obtain running job information would be through iterating through the list_jobs() API and parsing the response. For activities, you can obtain the number of running activities per job from the list_jobs() API so, note you need to iterate trough each project and in instances with lots of projects this can be costly.

    import dataiku
    client = dataiku.api_client()
    #get current project
    project = client.get_default_project()
    #to get all projects https://developer.dataiku.com/latest/concepts-and-examples/projects.html#listing-projects
    
    for job in project.list_jobs():
        job_id = job['def']['id']
        job_object = project.get_job(job_id)
        if job_object.get_status()['baseStatus']['state'] == 'RUNNING':
            print(job_object.get_status()['globalState'])


    Thanks




  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,088 Neuron
Setup Info
    Tags
      Help me…