Skip to main content

Airflow declarative DAGs via YAML.

Compatibility:

  • Python 2.7 / 3.5+

  • Airflow 1.10.4+

Key Features

  • Declarative DAGs in plain text YAML helps a lot to understand how DAG will looks like. Made for humans, not programmers.

  • It makes extremely hard to turn your DAGs into code mess. Even if you make complicated YAMLs generator the result would be readable for humans.

  • No more guilty about coupling business logic with task management system (Airflow). They now could coexists separated.

  • Static analysis becomes a trivial task.

  • It’s a good abstraction to create your own scheduler/worker compatible with original Airflow one.

Examples

Check tests/dags directory for example of DAGs which will works and which won’t. Use src/airflow_declarative/schema.py module for the reference about YAML file schema. It should be self descriptive.

Don’t be shy to experiment: trafaret-config will help you to understand what had gone wrong and why and where.

Usage

We provide support for two installation options:

  1. As a complementary side package for the upstream Airflow.

  2. As a built-in Airflow functionality using patches for Airflow.

Upstream Airflow

The idea is to put a Python script to the dags_folder which would load the declarative dags via airflow_declarative. More details: Installation using Upstream Airflow.

import os

import airflow_declarative

# Assuming that the yaml dags are located in the same directory
# as this Python module:
root = os.path.dirname(__file__)

dags_list = [
    airflow_declarative.from_path(os.path.join(root, item))
    for item in os.listdir(root)
    if item.endswith((".yml", ".yaml"))
]

globals().update({dag.dag_id: dag for dags in dags_list for dag in dags})

Patched Airflow

We provide ready to use patches in the patches directory. To use them you will need to apply a patch to a corresponding Airflow version and then build it yourself. More details: Installation using Patched Airflow.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

airflow-declarative-1.1.tar.gz (28.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

airflow_declarative-1.1-py2.py3-none-any.whl (19.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file airflow-declarative-1.1.tar.gz.

File metadata

  • Download URL: airflow-declarative-1.1.tar.gz
  • Upload date:
  • Size: 28.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.6

File hashes

Hashes for airflow-declarative-1.1.tar.gz
Algorithm Hash digest
SHA256 b9b3f3bb52c4e1f7620bccf89700c9a56c67f738b5b43ec59d4b2218e2ffb934
MD5 2b98a649b8c5628e82797f165ab85596
BLAKE2b-256 82b2cb077c51cf29a653f0f920c1292a1a7ae334b40c25b046f0fb64383e1ff3

See more details on using hashes here.

File details

Details for the file airflow_declarative-1.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for airflow_declarative-1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ebdddaef9436155839732d3ac9635551a46b90ed20b43e3ec5d96499d658a625
MD5 b184f5d2d317c99e0a72909cab994a9c
BLAKE2b-256 6c03c41df4e3df2ebfdbbebb02294b3ce636b64361a6fd540682fe77b0725068

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.1 This release

2 files

1.0

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page