ashb commented on a change in pull request #4863: [AIRFLOW-3841] Remove DagBag 
from /tree
URL: https://github.com/apache/airflow/pull/4863#discussion_r263332762
 
 

 ##########
 File path: airflow/www/views.py
 ##########
 @@ -1185,16 +1186,16 @@ def tree(self, session=None):
         else:
             base_date = dag.latest_execution_date or timezone.utcnow()
 
-        DR = models.DagRun
-        dag_runs = (
-            session.query(DR)
-            .filter(
-                DR.dag_id == dag.dag_id,
-                DR.execution_date <= base_date)
-            .order_by(DR.execution_date.desc())
-            .limit(num_runs)
-            .all()
-        )
+        with create_session() as session:
 
 Review comment:
   We've already got a `session` object in scope here.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to