Working with Tasks

Tasks in Agora are server-side processing jobs. There are two kinds:

  • UI tasks — configured via the Agora web interface.

  • Script tasks — defined by a YAML pipeline script.

Get all tasks

tasks = agora.get_tasks()
for t in tasks:
    print(f'{t.id:4d}  {t.name}')

Get a task by ID

from gtagora.models.task import TaskType

# UI task (default)
task = agora.get_task(10)

# Script task
script_task = agora.get_task(10, type=TaskType.SCRIPT)

Get a UI task

task = agora.get_ui_task(10)

Get a script task

task = agora.get_script_task(10)

Delete a task

agora.delete_task(task_id=10)

Load tasks from a JSON file

Useful for restoring or migrating task configurations:

from pathlib import Path

tasks = agora.load_tasks(Path('/config/tasks.json'))

Run a task on a dataset

Refer to the task’s documentation in the Agora web interface for which parameters it expects.

dataset = agora.get_dataset(158)
task    = agora.get_task(10)
task.run(dataset)

Note

Task execution is asynchronous on the server. Poll the task status or use Agora’s notification system to detect when a job completes.