uranusjr commented on code in PR #32883:
URL: https://github.com/apache/airflow/pull/32883#discussion_r1277219533


##########
airflow/utils/scheduler_health.py:
##########
@@ -36,11 +38,11 @@ def do_GET(self):
             try:
                 with create_session() as session:
                     scheduler_job = (
-                        session.query(Job)
+                        session.scalars(select(Job))
                         .filter_by(job_type=SchedulerJobRunner.job_type)
                         .filter_by(hostname=get_hostname())
                         .order_by(Job.latest_heartbeat.desc())
-                        .first()
+                        .limit(1)
                     )

Review Comment:
   You’re calling `filter_by` etc. against the result of `session.scalars` 
instead of `select`. The parenthesis on line 41 is probably misplaced?



##########
airflow/utils/scheduler_health.py:
##########
@@ -36,11 +38,11 @@ def do_GET(self):
             try:
                 with create_session() as session:
                     scheduler_job = (
-                        session.query(Job)
+                        session.scalars(select(Job))
                         .filter_by(job_type=SchedulerJobRunner.job_type)
                         .filter_by(hostname=get_hostname())
                         .order_by(Job.latest_heartbeat.desc())
-                        .first()
+                        .limit(1)
                     )

Review Comment:
   You’re calling `filter_by` etc. against the result of `session.scalars` 
instead of `select`. The parenthesis on line 41 is probably misplaced?



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