mhenc commented on a change in pull request #21731:
URL: https://github.com/apache/airflow/pull/21731#discussion_r820838656



##########
File path: airflow/jobs/scheduler_job.py
##########
@@ -868,17 +875,18 @@ def _do_scheduling(self, session) -> int:
                 if self.executor.slots_available <= 0:
                     # We know we can't do anything here, so don't even try!
                     self.log.debug("Executor full, skipping critical section")
-                    return 0
+                    num_queued_tis = 0
+                else:
 
-                timer = Stats.timer('scheduler.critical_section_duration')
-                timer.start()
+                    timer = Stats.timer('scheduler.critical_section_duration')
+                    timer.start()
 
-                # Find anything TIs in state SCHEDULED, try to QUEUE it (send 
it to the executor)
-                num_queued_tis = 
self._critical_section_execute_task_instances(session=session)
+                    # Find anything TIs in state SCHEDULED, try to QUEUE it 
(send it to the executor)
+                    num_queued_tis = 
self._critical_section_execute_task_instances(session=session)
 
-                # Make sure we only sent this metric if we obtained the lock, 
otherwise we'll skew the
-                # metric, way down
-                timer.stop(send=True)
+                    # Make sure we only sent this metric if we obtained the 
lock, otherwise we'll skew the
+                    # metric, way down

Review comment:
       ok, moved try inside the else




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