Skip to content

Commit

Permalink
Backfill: Don't create a DagRun if no tasks match task regex (#16461)
Browse files Browse the repository at this point in the history
Backfill should not create a DagRun in case there is no any task that matches the regex.

closes: #16460
(cherry picked from commit f2c79b2)
  • Loading branch information
dimonchik-suvorov authored and ashb committed Jun 22, 2021
1 parent 215492d commit 7c094fa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions airflow/cli/commands/dag_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 7c094fa

Please sign in to comment.