seanghaeli commented on code in PR #77290:
URL: https://github.com/apache/airflow/pull/77290#discussion_r4675817896


##########
airflow-core/src/airflow/jobs/triggerer_job_runner.py:
##########
@@ -961,6 +989,17 @@ def run_context(self) -> Iterator[None]:
         """Wrap the run loop. Subclasses can override to install 
setup/teardown."""
         yield
 
+    def kill(self, *args: Any, **kwargs: Any) -> None:
+        """Terminate the subprocess, then drain pending log uploads."""
+        try:
+            super().kill(*args, **kwargs)
+        finally:
+            # kill() is the last point that services subprocess requests, so a
+            # finished-trigger message can still arrive until it returns. Drain
+            # the pool only once it has, or a late finalize_trigger_log would
+            # submit to a shut-down executor and lose the log.
+            self._log_upload_executor.shutdown(wait=True)

Review Comment:
   This still runs on the forced exit: a second signal calls `kill(SIGKILL)`, 
and this waits for every queued upload before `sys.exit`. A second SIGTERM 
right after 300 triggers fired took 19 to 20 s to exit, twice, against about 1 
s on main. Could the forced path drop the queue instead, e.g. 
`shutdown(wait=False, cancel_futures=True)` when the signal is SIGKILL?



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