airflow-systemd

Run and monitor systemd-managed jobs from Apache Airflow.

Build Status codecov License PyPI

from airflow import DAG
from airflow_systemd import ServiceConfiguration, ServiceUnitConfiguration, Systemd, SystemdAirflowConfiguration

dag = DAG(dag_id="nightly-systemd", schedule="@daily")
config = SystemdAirflowConfiguration(
    scope="user",
    service={
        "nightly": ServiceUnitConfiguration(
            service=ServiceConfiguration(type="exec", exec_start="/opt/jobs/nightly")
        )
    },
)
Systemd(dag=dag, cfg=config)

The generated task lifecycle writes unit files, starts services, monitors state with airflow-ha, handles retriggers, stops services, and optionally removes the generated configuration. SystemdSSH applies the same lifecycle remotely.

Documentation

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

Ecosystem

Note

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