uranusjr commented on a change in pull request #18975:
URL: https://github.com/apache/airflow/pull/18975#discussion_r728906466



##########
File path: airflow/jobs/scheduler_job.py
##########
@@ -510,7 +510,15 @@ def _process_executor_events(self, session: Session = 
None) -> int:
 
         # Check state of finished tasks
         filter_for_tis = TI.filter_for_tis(tis_with_right_state)
-        tis: List[TI] = 
session.query(TI).filter(filter_for_tis).options(selectinload('dag_model')).all()
+        query = 
session.query(TI).filter(filter_for_tis).options(selectinload('dag_model'))
+        # row lock this entire set of tasks to make sure the scheduler doesn't 
fail when we have
+        # multi-schedulers
+        tis: List[TI] = with_row_locks(
+            query,
+            of=TI,
+            session=session,
+            **skip_locked(session=session),
+        ).all()

Review comment:
       ```suggestion
           tis: Iterator[TI] = with_row_locks(
               query,
               of=TI,
               session=session,
               **skip_locked(session=session),
           )
   ```
   
   Probably a good time to change this




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