Taragolis commented on code in PR #28128:
URL: https://github.com/apache/airflow/pull/28128#discussion_r1045070732


##########
airflow/jobs/scheduler_job.py:
##########
@@ -880,13 +880,24 @@ def _run_scheduler_loop(self) -> None:
                     # is finished to avoid concurrent access to the DB.
                     self.log.debug("Waiting for processors to finish since 
we're using sqlite")
                     self.processor_agent.wait_until_finished()
-
-                with create_session() as session:
-                    num_queued_tis = self._do_scheduling(session)
-
-                    self.executor.heartbeat()
-                    session.expunge_all()
-                    num_finished_events = 
self._process_executor_events(session=session)
+                
+                for attempt in run_with_db_retries():
+                    with attempt:
+                        start_time = time.time()
+                        try:
+                            with create_session() as session:
+                                num_queued_tis = self._do_scheduling(session)
+
+                                self.executor.heartbeat()
+                                session.expunge_all()
+                                num_finished_events = 
self._process_executor_events(session=session)
+                        except OperationalError as e:
+                            end_time = time.time()
+                            self.log.error("got a MySql exception (retry:" + 
str(
+                                attempt.retry_state.attempt_number) + ", total 
time in seconds: " + str(
+                                end_time - start_time) + "), details: " + 
str(e))

Review Comment:
   Do not use concatenations in logging
   
   ```suggestion
                               self.log.error(
                                   "got a MySql exception (retry: %s total time 
in seconds: %.3f), details: %s",
                                   attempt.retry_state.attempt_number,
                                   end_time - start_time,
                                   e
                               )
   ```



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