uranusjr commented on code in PR #75707:
URL: https://github.com/apache/airflow/pull/75707#discussion_r4385318835
##########
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:
This copies `WatchedSubprocess._signal_subprocess` with slightly different
semantics. Pull the existing version (it is better than this version) to a
common place and import it here instead.
--
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]