airflow-nomad

Run and monitor Nomad-managed jobs from Apache Airflow.

Build Status codecov License PyPI

from airflow import DAG
from airflow_nomad import Job, Nomad, NomadAirflowConfiguration, Task, TaskGroup

dag = DAG(dag_id="nightly-nomad", schedule="@daily")
config = NomadAirflowConfiguration(
    job=Job(
        id="nightly",
        type="batch",
        task_groups=[
            TaskGroup(
                name="nightly",
                tasks=[Task(name="nightly", driver="exec", config={"command": "/opt/jobs/nightly"})],
            )
        ],
    )
)
Nomad(dag=dag, cfg=config)

The generated task lifecycle writes and registers the jobspec, monitors current allocations with airflow-ha, handles retriggers, stops the job, and optionally removes the generated configuration.

Documentation

Published documentation is available at airflow-laminar.github.io/airflow-nomad.

Ecosystem

Note

This library was generated using copier from the Base Python Project Template repository.