Nomad operators and configuration for long-running tasks
Actively maintained. Last release 7 weeks ago, commits in 15 of the last 26 weeks. A safe choice.
pip install airflow-nomadREADME as published on PyPI with version 0.2.1.
airflow-nomad
Run and monitor Nomad-managed jobs from Apache Airflow.
from datetime import datetime, timezone
from airflow import DAG
from airflow_nomad import Job, Nomad, NomadAirflowConfiguration, Task, TaskGroup
dag = DAG(
dag_id="nightly-nomad",
schedule="@daily",
start_date=datetime(2025, 1, 1, tzinfo=timezone.utc),
catchup=False,
)
config = NomadAirflowConfiguration(
working_dir="/var/tmp/nightly-nomad",
job=Job(
id="airflow-nightly",
type="batch",
namespace="default",
datacenters=["dc1"],
task_groups=[
TaskGroup(
name="nightly",
tasks=[Task(name="nightly", driver="exec", config={"command": "/bin/sleep", "args": ["5"]})],
)
],
)
)
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 on successful completion. Workers use the
Nomad CLI to reach local or remote clusters through their HTTP API. Define the
same lifecycle in inline Python or airflow-config YAML.
Documentation
Start with the tutorial to run a short batch job on a development cluster and check cleanup. For an existing cluster, follow the Python or . Both use the same cluster credentials and namespace settings.