ashb commented on code in PR #44406:
URL: https://github.com/apache/airflow/pull/44406#discussion_r1860526902
##########
task_sdk/src/airflow/sdk/execution_time/supervisor.py:
##########
@@ -451,10 +449,38 @@ def _check_subprocess_exit(self):
def _send_heartbeat_if_needed(self):
"""Send a heartbeat to the client if heartbeat interval has passed."""
- if time.monotonic() - self._last_heartbeat >=
FASTEST_HEARTBEAT_INTERVAL:
+ # If the process has exited, we don't need to send any more heartbeats
+ if self._exit_code is not None:
+ return
Review Comment:
This isn't strictly true. The process has exit, but if we are entering this
function then the send final request to the server _probably_ hasn't happened
yet as it is after the return of `_monitor_subprocess`, in which case as long
as the supervisor is alive we should continue to heartbeat. (i.e. the server
side state of this TI is running still, so we should heartbeat it still.)
The exception (right now) is deferred state which we will send earlier (or
we will do once Amogh's PR is merged)
--
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]