airflow-core/docs/core-concepts/backfill.rst
.. Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
.. http://www.apache.org/licenses/LICENSE-2.0
.. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Backfill is when you create runs for past dates of a Dag. Airflow provides a mechanism to do this through the CLI and REST API. You provide a Dag, a start date, and an end date, and Airflow will create runs in the range according to the Dag's schedule.
Backfill does not make sense for Dags that don't have a time-based schedule.
There are three options for reprocessing behavior:
If the latest run is still running or is queued, we do not create another run, no matter the chosen reprocessing behavior.
You can set max_active_runs on a backfill and it will control how many Dag runs in
the backfill can run concurrently. Backfill max_active_runs is applied independently
the Dag max_active_runs setting.
You can run your backfill in reverse, i.e. latest runs first. The CLI option is --run-backwards.
Backfill dry run is a CLI option that will print out the dates that the backfill will consider creating runs for. Whether or not they will be created depends on your chosen reprocessing behavior and the states of any existing runs in the range at the time you actually run the backfill.
Backfill can be created from either the CLI or the UI.
For CLI, below is an example command:
.. code-block:: bash
airflow backfill create --dag-id tutorial \
--start-date 2015-06-01 \
--end-date 2015-06-07 \
--reprocessing-behavior failed \
--max-active-runs 3 \
--run-backwards \
--dag-run-conf '{"my": "param"}'
For UI, follow the following steps:
Navigate to a Dag's Details page and click Trigger.
In the pop-up window, select Backfill.
Fill in the form:
Missing Runs, Missing and Errored Runs, or All Runs.dag_run.conf... image:: ../img/ui-light/backfill.png :alt: Backfill pop-up window (Light Mode)