2014 by Maxime Beauchemin at Airbnb • Since 2016 at Apache (incubator), Apache License • 400+ contributors • Used by 150+ companies • Version 1.9, 1.10 under vote • Documentation: https://airflow.apache.org/ • Code: https://github.com/apache/incubator-airflow
a platform to programmatically author, schedule and monitor workflows* • A workflow is a DAG of tasks, defined as Python code • The Scheduler executes tasks on workers • A Web UI to visualize, monitor, and troubleshoot runs * https://airflow.apache.org/index.html
of tasks with their relationships and dependencies • Task ◦ Instance of an operator • Operator and Sensor ◦ Python class that defines what to do ◦ PythonOperator, BashOperator ◦ SimpleHttpOperator, PostgresOperator, DockerOperator ◦ S3KeySensors, HdfsSensor
task instance ◦ Specific run of a DAG and each of its tasks ◦ Identified by dag_id, task_id, and execution_date ◦ Persisted in metadata database (tables dag_run and task_instance) ◦ Have a mutating state: queued, running, success, failed, skipped, ... • Many more: ◦ Conf, XCom, Variables, Hooks, SubDAGs, Templating, Trigger rules, SLAs, ...
• Simulation consist of multiple steps • Currently a more or less static process: ◦ Preparation, run simulation (hours to days), persist results, generate visualization and artifacts for postprocessing • In future more flexibility is required: ◦ Started to look into Airflow in March 2018 ◦ First workflow to generate postprocessing artifacts in production ◦ Workflow for a new simulation type in progress
• No periodic scheduled workflows, but event triggered ◦ Via AWS SQS, message contains the dag_id to trigger and all input parameters (pointers to immutable data like CAD files and simulation spec) ◦ One periodic job that polls SQS and triggers DAG runs • No actual processing, but orchestration ◦ Trigger computation at external system, use sensor to monitor progress • Some custom operators (JSON, context headers)
careful when updating existing/running DAGs ◦ Don’t rename DAGs and tasks • Use CeleryExecutor for production ◦ Or KubernetesExecutor with 1.10? • execution_date is part of primary key • A running sensor blocks a worker slot • Separate business logic from Airflow tasks (unit tests) • Make your DAGs and tasks idempotent and deterministic to allow retries