kaxil commented on code in PR #56422:
URL: https://github.com/apache/airflow/pull/56422#discussion_r2476088258


##########
airflow-core/src/airflow/models/serialized_dag.py:
##########
@@ -414,7 +414,14 @@ def write_dag(
         serialized_dag_hash = session.scalars(
             select(cls.dag_hash).where(cls.dag_id == 
dag.dag_id).order_by(cls.created_at.desc())
         ).first()
-        dag_version = DagVersion.get_latest_version(dag.dag_id, 
session=session)
+        dag_version = session.scalar(
+            select(DagVersion)
+            .where(DagVersion.dag_id == dag.dag_id)
+            .options(joinedload(DagVersion.task_instances))
+            .options(joinedload(DagVersion.serialized_dag))

Review Comment:
   This is wrong -- why are we loading the entire serialized dag again before 
checking if the hash has changed or not.
   
   cc @ephraimbuddy 



-- 
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