airflow icon indicating copy to clipboard operation
airflow copied to clipboard

Test a dag

Open nave91 opened this issue 11 years ago • 2 comments

Is there a way to test the entire dag without backfilling it?

Currently task_id is mandatory when using airflow test

» airflow test -h                                     vagrant@vagrant-ubuntu-trusty-64
usage: airflow test [-h] [-sd SUBDIR] dag_id task_id execution_date

positional arguments:
  dag_id                The id of the dag to run
  task_id               The task_id to run
  execution_date        The execution date to run

optional arguments:
  -h, --help            show this help message and exit
  -sd SUBDIR, --subdir SUBDIR
                        File location or directory from which to look for the
                        dag

Also backfill doesn't have an option of test run

» airflow backfill -h                                 vagrant@vagrant-ubuntu-trusty-64
usage: airflow backfill [-h] [-t TASK_REGEX] [-s START_DATE] [-e END_DATE]
                        [-m] [-l] [-x] [-a] [-i] [-sd SUBDIR]
                        dag_id

positional arguments:
  dag_id                The id of the dag to run

optional arguments:
  -h, --help            show this help message and exit
  -t TASK_REGEX, --task_regex TASK_REGEX
                        The regex to filter specific task_ids to backfill
                        (optional)
  -s START_DATE, --start_date START_DATE
                        Override start_date YYYY-MM-DD
  -e END_DATE, --end_date END_DATE
                        Override end_date YYYY-MM-DD
  -m, --mark_success    Mark jobs as succeeded without running them
  -l, --local           Run the task using the LocalExecutor
  -x, --donot_pickle    Do not attempt to pickle the DAG object to send over
                        to the workers, just tell the workers to run their
                        version of the code.
  -a, --include_adhoc   Include dags with the adhoc parameter.
  -i, --ignore_dependencies
                        Skip upstream tasks, run only the tasks matching the
                        regexp. Only works in conjunction with task_regex
  -sd SUBDIR, --subdir SUBDIR
                        File location or directory from which to look for the
                        dag

nave91 avatar Nov 04 '15 19:11 nave91

We usually run a backfill on a single schedule to test/debug. You may (or may not) want point your AIRFLOW_CONFIG env var to an alternate airflow.cfg file. It for you to define how you want to insulate your tests and prod environments

mistercrunch avatar Nov 04 '15 23:11 mistercrunch

aah cool :+1: I was checking if I was missing something from the documentation. Thank you so much!! You da man.

resize

nave91 avatar Nov 05 '15 20:11 nave91