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


##########
airflow/api_connexion/endpoints/task_instance_endpoint.py:
##########
@@ -533,9 +533,11 @@ def post_set_task_instances_state(*, dag_id: str, session: 
Session = NEW_SESSION
             detail=f"Task instance not found for task {task_id!r} on 
execution_date {execution_date}"
         )
 
-    if run_id and not session.get(
-        TI, {"task_id": task_id, "dag_id": dag_id, "run_id": run_id, 
"map_index": -1}
-    ):
+    select_stmt = select(TI).where(
+        TI.dag_id == dag_id, TI.task_id == task_id, TI.run_id == run_id, 
TI.map_index == -1
+    )
+
+    if run_id and not session.scalars(select_stmt).one_or_none():

Review Comment:
   The reason for this is explained in [**Issues identified Point 
(3)**](https://github.com/apache/airflow/pull/43243#issuecomment-2439774584)
   



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