ashb commented on code in PR #44406:
URL: https://github.com/apache/airflow/pull/44406#discussion_r1860527765


##########
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
+
+        if time.monotonic() - self._last_heartbeat >= MIN_HEARTBEAT_INTERVAL:
             try:
                 self.client.task_instances.heartbeat(self.ti_id, 
pid=self._process.pid)
                 self._last_heartbeat = time.monotonic()
+            except ServerResponseError as e:
+                # TODO: Should we instead check httpx.HTTPStatusError?

Review Comment:
   HTTPStatusError will happen when we get a 4xx/5xx that we can't parse.



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