uranusjr commented on code in PR #75707:
URL: https://github.com/apache/airflow/pull/75707#discussion_r4385351856


##########
task-sdk/src/airflow/sdk/coordinators/_subprocess.py:
##########
@@ -206,6 +206,20 @@ def _build_runtime_env() -> dict[str, str]:
     }
 
 
+def _signal_process_tree(proc: subprocess.Popen, sig: signal.Signals) -> None:
+    """
+    Deliver ``sig`` to *proc*'s process group, so everything the task spawned 
is reached.
+
+    Falls back to the pid when the group cannot be signalled, and when *proc* 
is in the
+    supervisor's own group, which ``killpg`` would signal too.
+    """
+    with contextlib.suppress(OSError):
+        if (pgid := os.getpgid(proc.pid)) != os.getpgid(0):
+            os.killpg(pgid, sig)
+            return
+    proc.send_signal(sig)

Review Comment:
   There is no real-process test for the startup-failure path: a runtime that 
spawns a child and then exits before connecting.



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