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


##########
task-sdk/src/airflow/sdk/execution_time/supervisor.py:
##########
@@ -669,18 +704,42 @@ def _service_subprocess(self, max_wait_time: float, 
raise_on_timeout: bool = Fal
                 key.fileobj.close()  # type: ignore[union-attr]
 
         # Check if the subprocess has exited
-        return self._check_subprocess_exit(raise_on_timeout=raise_on_timeout)
+        return self._check_subprocess_exit(raise_on_timeout=raise_on_timeout, 
expect_signal=expect_signal)
 
-    def _check_subprocess_exit(self, raise_on_timeout: bool = False) -> int | 
None:
+    def _check_subprocess_exit(
+        self, raise_on_timeout: bool = False, expect_signal: None | int = None
+    ) -> int | None:
         """Check if the subprocess has exited."""
-        if self._exit_code is None:
-            try:
-                self._exit_code = self._process.wait(timeout=0)
-                log.debug("%s process exited", type(self).__name__, 
exit_code=self._exit_code)
-                self._close_unused_sockets(self.stdin)
-            except psutil.TimeoutExpired:
-                if raise_on_timeout:
-                    raise
+        if self._exit_code is not None:
+            return self._exit_code
+
+        try:
+            self._exit_code = self._process.wait(timeout=0)
+        except psutil.TimeoutExpired:
+            if raise_on_timeout:
+                raise
+        else:
+            self._close_unused_sockets(self.stdin)
+            # Put a message in the viewable task logs
+
+            if expect_signal is not None and self._exit_code == -expect_signal:
+                # Bypass logging, the caller expected us to exit with this
+                return self._exit_code

Review Comment:
   This is to stop the log about "abnormal exit" from calling `kill()` which 
already adds its own logging.



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