AutomationDev85 commented on code in PR #43215:
URL: https://github.com/apache/airflow/pull/43215#discussion_r1814613164


##########
providers/src/airflow/providers/edge/executors/edge_executor.py:
##########
@@ -86,9 +88,30 @@ def execute_async(
             )
         )
 
-    @provide_session
-    def sync(self, session: Session = NEW_SESSION) -> None:
-        """Sync will get called periodically by the heartbeat method."""
+    def _check_worker_liveness(self, session: Session) -> bool:
+        """Reset worker state if heartbeat timed out."""
+        changed = False
+        heartbeat_interval: int = conf.getint("edge", "heartbeat_interval")
+        lifeless_workers: list[EdgeWorkerModel] = (
+            session.query(EdgeWorkerModel)
+            .filter(
+                EdgeWorkerModel.state != EdgeWorkerState.UNKNOWN
+                and EdgeWorkerModel.state != EdgeWorkerState.OFFLINE
+                and EdgeWorkerModel.last_update
+                < (timezone.utcnow() - timedelta(seconds=heartbeat_interval * 
5))

Review Comment:
   EdgeWorkerModel.state.not_in is not working. I changed the code to a 
different check.



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