uranusjr commented on code in PR #38553:
URL: https://github.com/apache/airflow/pull/38553#discussion_r1547078170


##########
airflow/utils/cli.py:
##########
@@ -231,10 +231,11 @@ def get_dag(subdir: str | None, dag_id: str, from_db: 
bool = False) -> DAG:
 
     if from_db:
         dagbag = DagBag(read_dags_from_db=True)
+        dag = dagbag.get_dag(dag_id)  # get_dag loads from the DB as requested
     else:
         first_path = process_subdir(subdir)
         dagbag = DagBag(first_path)
-    dag = dagbag.get_dag(dag_id)
+        dag = dagbag.dags.get(dag_id)  # avoids network calls made in get_dag

Review Comment:
   ```suggestion
           dag = dagbag.dags.get(dag_id)  # avoids db calls made in get_dag
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to