uranusjr commented on a change in pull request #22184:
URL: https://github.com/apache/airflow/pull/22184#discussion_r825278217



##########
File path: airflow/dag_processing/processor.py
##########
@@ -375,16 +375,15 @@ def manage_slas(self, dag: DAG, session: Session = None) 
-> None:
             .group_by(TI.task_id)
             .subquery('sq')
         )
-        # get recorded SlaMiss
-        recorded_slas_query = set(
-            session.query(SlaMiss.dag_id, SlaMiss.task_id, 
SlaMiss.execution_date).filter(
+        recorded_sla_misses = set(
+            session.query(SlaMiss.dag_id, SlaMiss.task_id, SlaMiss.run_id, 
SlaMiss.map_index).filter(
                 SlaMiss.dag_id == dag.dag_id, SlaMiss.task_id.in_(dag.task_ids)
             )
         )
 
         max_tis: Iterator[TI] = (
             session.query(TI)
-            .join(TI.dag_run)
+            .join(TI.dag_run)  # todo: why?

Review comment:
       I believe this can be removed now. The `lazy="joined"` setting on 
`TI.dag_run` is a recent-ish addition, and this is likely added before that to 
prevent an N+1 query issue in the `for ti in max_tis` loop below that accesses 
`ti.dag_run`.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to