This is an automated email from the ASF dual-hosted git repository.

ash pushed a commit to branch v2-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 7c094faf957d612f581137fe79fcd005f652fbf4
Author: Dmirty Suvorov <[email protected]>
AuthorDate: Wed Jun 16 23:07:58 2021 +0300

    Backfill: Don't create a DagRun if no tasks match task regex (#16461)
    
    Backfill should not create a DagRun in case there is no any task that 
matches the regex.
    
    closes: #16460
    (cherry picked from commit f2c79b238f4ea3ee801038a6305b925f2f4e753b)
---
 airflow/cli/commands/dag_command.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/airflow/cli/commands/dag_command.py 
b/airflow/cli/commands/dag_command.py
index fe2f329..e739162 100644
--- a/airflow/cli/commands/dag_command.py
+++ b/airflow/cli/commands/dag_command.py
@@ -78,6 +78,10 @@ def dag_backfill(args, dag=None):
         dag = dag.partial_subset(
             task_ids_or_regex=args.task_regex, include_upstream=not 
args.ignore_dependencies
         )
+        if not dag.task_dict:
+            raise AirflowException(
+                f"There are no tasks that match '{args.task_regex}' regex. 
Nothing to run, exiting..."
+            )
 
     run_conf = None
     if args.conf:

Reply via email to