jscheffl commented on code in PR #50338:
URL: https://github.com/apache/airflow/pull/50338#discussion_r2079310532
##########
providers/edge3/src/airflow/providers/edge3/executors/edge_executor.py:
##########
@@ -177,7 +177,30 @@ def _check_worker_liveness(self, session: Session) -> bool:
.with_for_update(skip_locked=True)
.filter(
EdgeWorkerModel.state.not_in(
- [EdgeWorkerState.UNKNOWN, EdgeWorkerState.OFFLINE,
EdgeWorkerState.OFFLINE_MAINTENANCE]
+ [
+ EdgeWorkerState.UNKNOWN,
+ EdgeWorkerState.OFFLINE,
+ EdgeWorkerState.OFFLINE_MAINTENANCE,
+ EdgeWorkerState.MAINTENANCE_MODE,
+ EdgeWorkerState.MAINTENANCE_PENDING,
+ EdgeWorkerState.MAINTENANCE_REQUEST,
+ ]
+ ),
+ EdgeWorkerModel.last_update < (timezone.utcnow() -
timedelta(seconds=heartbeat_interval * 5)),
+ )
+ .all()
+ )
+
+ lifeless_workers_maintenance: list[EdgeWorkerModel] = (
Review Comment:
Instead of making a second query and a second loop... can you use the
original query and check the condition in the loop below?
--
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]