AutomationDev85 commented on code in PR #43215:
URL: https://github.com/apache/airflow/pull/43215#discussion_r1811946630
##########
providers/src/airflow/providers/edge/executors/edge_executor.py:
##########
@@ -86,9 +88,32 @@ def execute_async(
)
)
- @provide_session
- def sync(self, session: Session = NEW_SESSION) -> None:
- """Sync will get called periodically by the heartbeat method."""
+ def _check_alive_worker(self, session: Session) -> bool:
+ """Reset worker state if heartbeat timed out."""
+ changed = False
+ heartbeat_interval: int = conf.getint("edge", "heartbeat_interval")
+ workers: list[EdgeWorkerModel] = session.query(EdgeWorkerModel).all()
+
+ for worker in workers:
+ connected = 1
+ if not worker.last_update or worker.last_update < (
+ timezone.utcnow() - timedelta(seconds=heartbeat_interval * 5)
+ ):
Review Comment:
done
##########
providers/src/airflow/providers/edge/executors/edge_executor.py:
##########
@@ -86,9 +88,32 @@ def execute_async(
)
)
- @provide_session
- def sync(self, session: Session = NEW_SESSION) -> None:
- """Sync will get called periodically by the heartbeat method."""
+ def _check_alive_worker(self, session: Session) -> bool:
Review Comment:
done
--
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]