Prab-27 commented on code in PR #59918:
URL: https://github.com/apache/airflow/pull/59918#discussion_r2700658277


##########
airflow-core/src/airflow/jobs/scheduler_job_runner.py:
##########
@@ -2432,19 +2432,23 @@ def _get_num_times_stuck_in_queued(self, ti: 
TaskInstance, session: Session = NE
             .limit(1)
         )
 
-        query = session.query(Log).where(
-            Log.task_id == ti.task_id,
-            Log.dag_id == ti.dag_id,
-            Log.run_id == ti.run_id,
-            Log.map_index == ti.map_index,
-            Log.try_number == ti.try_number,
-            Log.event == TASK_STUCK_IN_QUEUED_RESCHEDULE_EVENT,
+        statement = (
+            select(func.count())
+            .select_from(Log)

Review Comment:
   Yes ! You are right !! but what if  - (It's just my thought)
   
   statement =  select(Log).where(
               Log.task_id == ti.task_id,
               Log.dag_id == ti.dag_id,
               Log.run_id == ti.run_id,
               Log.map_index == ti.map_index,
               Log.try_number == ti.try_number,
               Log.event == TASK_STUCK_IN_QUEUED_RESCHEDULE_EVENT,
   
   and we use `func.count` in `count_result`  like 
session.scalar(select(func.count(statement)).select_from(Log)
   
   I apologize if I created any confusion 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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to