You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by je...@apache.org on 2021/11/03 21:30:11 UTC

[airflow] 12/17: Clarify dag-not-found error message (#19338)

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

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

commit a0934d154a1754af76e7aafb9a932b866caab450
Author: Daniel Standish <15...@users.noreply.github.com>
AuthorDate: Mon Nov 1 09:22:23 2021 -0700

    Clarify dag-not-found error message (#19338)
    
    In this context, what's really happening is, we can't find the dag.  From a user
    perspective, when you encounter this error, 'could not find the dag' is
    a more intuitive representation of the problem than 'could not find the dag_id'.
    
    (cherry picked from commit 0be26b47439de11935b8b8b246a4cad35fbb8659)
---
 airflow/utils/cli.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/airflow/utils/cli.py b/airflow/utils/cli.py
index 6415676..db58b88 100644
--- a/airflow/utils/cli.py
+++ b/airflow/utils/cli.py
@@ -177,8 +177,7 @@ def get_dag_by_file_location(dag_id: str):
     dag_model = DagModel.get_current(dag_id)
     if dag_model is None:
         raise AirflowException(
-            'dag_id could not be found: {}. Either the dag did not exist or it failed to '
-            'parse.'.format(dag_id)
+            f"Dag {dag_id!r} could not be found; either it does not exist or it failed to parse."
         )
     dagbag = DagBag(dag_folder=dag_model.fileloc)
     return dagbag.dags[dag_id]
@@ -191,8 +190,7 @@ def get_dag(subdir: Optional[str], dag_id: str) -> "DAG":
     dagbag = DagBag(process_subdir(subdir))
     if dag_id not in dagbag.dags:
         raise AirflowException(
-            'dag_id could not be found: {}. Either the dag did not exist or it failed to '
-            'parse.'.format(dag_id)
+            f"Dag {dag_id!r} could not be found; either it does not exist or it failed to parse."
         )
     return dagbag.dags[dag_id]