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 ------------- .. code-block:: python tasks = agora.get_tasks() for t in tasks: print(f'{t.id:4d} {t.name}') Get a task by ID ---------------- .. code-block:: python 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 ~~~~~~~~~~~~~ .. code-block:: python task = agora.get_ui_task(10) Get a script task ~~~~~~~~~~~~~~~~~ .. code-block:: python task = agora.get_script_task(10) Delete a task ------------- .. code-block:: python agora.delete_task(task_id=10) Load tasks from a JSON file ---------------------------- Useful for restoring or migrating task configurations: .. code-block:: python 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. .. code-block:: python 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.