From 33e6a2c825c89460a346c6a5e150a1ff058e7f48 Mon Sep 17 00:00:00 2001 From: Dmitry Suvorov Date: Tue, 15 Jun 2021 17:20:17 +0300 Subject: [PATCH 1/4] [#16460]: Fixed typos in task regex param Backfill should not create a DagRun in case there is no any task that matches the regex. --- 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 fe2f329fef5db..4bb3c3db09499 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: + err_message = f"There is no any task that match '{args.task_regex}' regex. " + "Nothing to run, exiting..." + raise AirflowException(err_message) run_conf = None if args.conf: From 8361cf37b0734f33c6584502f00fc25ed2287769 Mon Sep 17 00:00:00 2001 From: Dmitry Suvorov Date: Tue, 15 Jun 2021 17:46:42 +0300 Subject: [PATCH 2/4] [#16460]: Fixed indent --- airflow/cli/commands/dag_command.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/airflow/cli/commands/dag_command.py b/airflow/cli/commands/dag_command.py index 4bb3c3db09499..0c625afb32bbb 100644 --- a/airflow/cli/commands/dag_command.py +++ b/airflow/cli/commands/dag_command.py @@ -79,9 +79,10 @@ def dag_backfill(args, dag=None): task_ids_or_regex=args.task_regex, include_upstream=not args.ignore_dependencies ) if not dag.task_dict: - err_message = f"There is no any task that match '{args.task_regex}' regex. " - "Nothing to run, exiting..." - raise AirflowException(err_message) + raise AirflowException( + f"There is no any task that match '{args.task_regex}' regex. " + "Nothing to run, exiting..." + ) run_conf = None if args.conf: From 5dda2ca23338e5ef00b63c4dd16658ba681b4f95 Mon Sep 17 00:00:00 2001 From: Dmitry Suvorov Date: Tue, 15 Jun 2021 19:08:15 +0300 Subject: [PATCH 3/4] [#16460]: Fixed pre-commit issue --- airflow/cli/commands/dag_command.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/airflow/cli/commands/dag_command.py b/airflow/cli/commands/dag_command.py index 0c625afb32bbb..319652e634895 100644 --- a/airflow/cli/commands/dag_command.py +++ b/airflow/cli/commands/dag_command.py @@ -80,8 +80,7 @@ def dag_backfill(args, dag=None): ) if not dag.task_dict: raise AirflowException( - f"There is no any task that match '{args.task_regex}' regex. " - "Nothing to run, exiting..." + f"There is no any task that match '{args.task_regex}' regex. Nothing to run, exiting..." ) run_conf = None From 39be8c908ffe58ee7151ce359cf1b5af3f24a1ee Mon Sep 17 00:00:00 2001 From: Kaxil Naik Date: Tue, 15 Jun 2021 22:02:06 +0100 Subject: [PATCH 4/4] Update airflow/cli/commands/dag_command.py --- airflow/cli/commands/dag_command.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airflow/cli/commands/dag_command.py b/airflow/cli/commands/dag_command.py index 319652e634895..e739162540fb4 100644 --- a/airflow/cli/commands/dag_command.py +++ b/airflow/cli/commands/dag_command.py @@ -80,7 +80,7 @@ def dag_backfill(args, dag=None): ) if not dag.task_dict: raise AirflowException( - f"There is no any task that match '{args.task_regex}' regex. Nothing to run, exiting..." + f"There are no tasks that match '{args.task_regex}' regex. Nothing to run, exiting..." ) run_conf = None