Metadata-Version: 2.5
Name: airflow-nomad
Version: 0.2.0
Summary: Nomad operators and configuration for long-running tasks
Project-URL: Repository, https://github.com/airflow-laminar/airflow-nomad
Project-URL: Homepage, https://github.com/airflow-laminar/airflow-nomad
Author-email: the airflow-nomad authors <t.paine154@gmail.com>
License: Apache-2.0
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.11
Requires-Dist: airflow-ha<1.7,>=1.6.5
Requires-Dist: airflow-pydantic<1.8,>=1.7.0
Requires-Dist: nomad-pydantic<0.3,>=0.2.0
Provides-Extra: airflow
Requires-Dist: apache-airflow-providers-ssh; extra == 'airflow'
Requires-Dist: apache-airflow-providers-standard; extra == 'airflow'
Requires-Dist: apache-airflow<3,>=2.9; extra == 'airflow'
Provides-Extra: airflow3
Requires-Dist: apache-airflow-providers-ssh; extra == 'airflow3'
Requires-Dist: apache-airflow-providers-standard; extra == 'airflow3'
Requires-Dist: apache-airflow<3.4,>=3; extra == 'airflow3'
Provides-Extra: develop
Requires-Dist: airflow-config<1.13,>=1.12; extra == 'develop'
Requires-Dist: airflow-pydantic<1.8,>=1.7.0; extra == 'develop'
Requires-Dist: build; extra == 'develop'
Requires-Dist: bump-my-version; extra == 'develop'
Requires-Dist: check-dist; extra == 'develop'
Requires-Dist: codespell; extra == 'develop'
Requires-Dist: hatchling; extra == 'develop'
Requires-Dist: mdformat; extra == 'develop'
Requires-Dist: mdformat-frontmatter; extra == 'develop'
Requires-Dist: mdformat-tables>=1; extra == 'develop'
Requires-Dist: nomad-pydantic<0.3,>=0.2.0; extra == 'develop'
Requires-Dist: pytest; extra == 'develop'
Requires-Dist: pytest-cov; extra == 'develop'
Requires-Dist: ruff; extra == 'develop'
Requires-Dist: twine; extra == 'develop'
Requires-Dist: ty; extra == 'develop'
Requires-Dist: uv; extra == 'develop'
Requires-Dist: wheel; extra == 'develop'
Description-Content-Type: text/markdown

# airflow-nomad

Run and monitor Nomad-managed jobs from Apache Airflow.

[![Build Status](https://github.com/airflow-laminar/airflow-nomad/actions/workflows/build.yaml/badge.svg?branch=main&event=push)](https://github.com/airflow-laminar/airflow-nomad/actions/workflows/build.yaml)
[![codecov](https://codecov.io/gh/airflow-laminar/airflow-nomad/branch/main/graph/badge.svg)](https://codecov.io/gh/airflow-laminar/airflow-nomad)
[![License](https://img.shields.io/github/license/airflow-laminar/airflow-nomad)](https://github.com/airflow-laminar/airflow-nomad)
[![PyPI](https://img.shields.io/pypi/v/airflow-nomad.svg)](https://pypi.python.org/pypi/airflow-nomad)

```python
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](docs/src/tutorial.md) to run a short batch job on a
development cluster and check cleanup. For an existing cluster, follow the
[Python](docs/src/how-to.md#how-to-run-a-job-in-python) or
[`airflow-config` guide](docs/src/how-to.md#how-to-run-a-job-with-airflow-config).
Both use the same cluster credentials and namespace settings.

Use the [observability guide](docs/src/observability.md) to forward task logs,
attach failure callbacks, or monitor a persistent job between management runs.

The [API reference](docs/src/api.md) lists configuration defaults, monitoring
settings, and task boundaries. [Why Airflow owns the lifecycle](docs/src/explanation.md)
explains allocation state, persistent services, and scheduling ownership.

Published documentation is available at
[airflow-laminar.github.io/airflow-nomad](https://airflow-laminar.github.io/airflow-nomad/).

## Ecosystem

- [nomad-pydantic](https://github.com/airflow-laminar/nomad-pydantic) supplies jobspec models and the Nomad CLI client.
- [supervisor-pydantic](https://github.com/airflow-laminar/supervisor-pydantic), [systemd-pydantic](https://github.com/airflow-laminar/systemd-pydantic), and [cron-pydantic](https://github.com/airflow-laminar/cron-pydantic) model alternative runtimes.
- [airflow-supervisor](https://github.com/airflow-laminar/airflow-supervisor) and [airflow-systemd](https://github.com/airflow-laminar/airflow-systemd) provide analogous long-running job lifecycles.
- [airflow-cron](https://github.com/airflow-laminar/airflow-cron) converts cron jobs into ordinary Airflow tasks.
- [airflow-pydantic](https://github.com/airflow-laminar/airflow-pydantic) supplies declarative task and connection models.
- [airflow-config](https://github.com/airflow-laminar/airflow-config) produces YAML-driven DAGs.

> [!NOTE]
> This library was generated using [copier](https://copier.readthedocs.io/en/stable/) from the [Base Python Project Template repository](https://github.com/python-project-templates/base).
