You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/12/05 07:21:02 UTC

[GitHub] [airflow] XD-DENG commented on a change in pull request #6652: [AIRFLOW-5548] [AIRFLOW-5550] REST API enhancement - dag info, task …

XD-DENG commented on a change in pull request #6652: [AIRFLOW-5548] [AIRFLOW-5550] REST API enhancement - dag info, task …
URL: https://github.com/apache/airflow/pull/6652#discussion_r354141777
 
 

 ##########
 File path: airflow/api/common/experimental/__init__.py
 ##########
 @@ -45,3 +45,10 @@ def check_and_get_dagrun(dag: DagModel, execution_date: datetime) -> DagRun:
                          .format(execution_date, dag.dag_id))
         raise DagRunNotFound(error_message)
     return dagrun
+
+
+def check_and_get_dags():
+    """Get the dag ids present in the dagbag"""
+    dagbag = DagBag()
 
 Review comment:
   Calling `DagBag()` is a quite expensive action. You may want to get the list of dag ids from DB instead.
   
   On the other hand, my personal preference is not to have a new separate function if what you're doing inside is very straightforward & not being used at multiple locations (here this `check_and_get_dags()` function is only used at one location).

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services