Skip to main content

MultiDagRunPlugin for airflow

Project description

Build Status

Multi dag run

This plugin contains operators for triggering a DAG run multiple times and you can dynamically specify how many DAG run instances create.

It can be useful when you have to handle a big data and you want to split it into chunks and run multiple instances of the same task in parallel.

When you see a lot launched target DAGs you can set up more workers. So this makes it pretty easy to scale.


pip install airflow_multi_dagrun


Code for scheduling dags

import datetime as dt
from airflow import DAG

from airflow_multi_dagrun.operators import TriggerMultiDagRunOperator

def generate_dag_run():
    for i in range(100):
        yield {'index': i}

default_args = {
    'owner': 'airflow',
    'start_date': dt.datetime(2015, 6, 1),

dag = DAG('reindex_scheduler', schedule_interval=None, default_args=default_args)

ran_dags = TriggerMultiDagRunOperator(

This code will schedule dag with id example_target_dag 100 times and pass payload to it.

Example of triggered dag:

dag = DAG(
   default_args={'start_date': datetime.utcnow(), 'owner': 'airflow'},

def run_this_func(dag_run, **kwargs):
   print("Chunk received: {}".format(dag_run.conf['index']))

chunk_handler = PythonOperator(

Run example

There is docker-compose config, so it requires docker to be installed: docker, docker-compose

  1. make init - create db
  2. make add-admin - create admin user (is asks a password)
  3. make web - start docker containers, run airflow webserver
  4. make scheduler - start docker containers, run airflow scheduler

make down will stop and remove docker containers


If you have found a bug or have some idea for improvement feel free to create an issue or pull request.


Apache 2.0

Project details

Download files

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

Source Distribution

airflow_multi_dagrun-2.3.1.tar.gz (7.8 kB view hashes)

Uploaded Source

Built Distribution

airflow_multi_dagrun-2.3.1-py3-none-any.whl (9.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page