jscheffl commented on code in PR #44914:
URL: https://github.com/apache/airflow/pull/44914#discussion_r1883985206


##########
providers/src/airflow/providers/edge/executors/edge_executor.py:
##########
@@ -183,16 +183,7 @@ def _purge_jobs(self, session: Session) -> bool:
         jobs: list[EdgeJobModel] = (
             session.query(EdgeJobModel)
             .with_for_update(skip_locked=True)
-            .filter(
-                EdgeJobModel.state.in_(
-                    [
-                        TaskInstanceState.RUNNING,
-                        TaskInstanceState.SUCCESS,
-                        TaskInstanceState.FAILED,
-                        TaskInstanceState.REMOVED,
-                    ]
-                )
-            )
+            .filter(EdgeJobModel.state.isnot(TaskInstanceState.QUEUED))

Review Comment:
   MySQL is failing and seems it does not like the "for update" lock in 
conjunction with negative filter... anyway I'd propose to stay with a positive 
filter like this... (as you are adding two states)
   ```suggestion
               .filter(
                   EdgeJobModel.state.in_(
                       [
                           TaskInstanceState.RUNNING,
                           TaskInstanceState.SUCCESS,
                           TaskInstanceState.FAILED,
                           TaskInstanceState.REMOVED,
                           TaskInstanceState.RESTARTING,
                           TaskInstanceState.UP_FOR_RETRY,
                       ]
                   )
               )```



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