villebro opened a new pull request, #2590:
URL: https://github.com/apache/datafusion-ballista/pull/2590

   ## Rationale for this change
   
   With this change, containers built from the published images stop the way 
their Ballista processes expect. Today each entrypoint runs its binary as a 
child of bash, which stays PID 1 and drops the SIGTERM from `docker stop` or 
the kubelet. Executors never drain, and every container waits out its grace 
period to be SIGKILLed.
   
   Closes #2589.
   
   ## What changes are included in this PR?
   
   - **Entrypoints.** The executor, scheduler and CLI entrypoints `exec` their 
binary.
   - **tini.** The scheduler, executor, standalone and CLI images run under 
tini, which passes signals on. The executor's SIGTERM handler starts its 
graceful shutdown. The scheduler has no handler yet (#565), so it exits on 
SIGTERM instead of waiting for SIGKILL.
   - **Standalone.** The entrypoint stops the executor first, so it drains 
while the scheduler is still up, then stops the scheduler, and passes on the 
executor's exit status. It waits for the scheduler's port with bash's 
`/dev/tcp`, because the image doesn't install `nc`.
   - **Compose.** The benchmarks container gets `init: true` for its `sleep 
infinity`.
   - **Docs.** The Docker guide's `docker ps` output shows the new entrypoint. 
The Kubernetes guide notes that two settings cap an executor's drain at 30 
seconds by default: the pods' `terminationGracePeriodSeconds` and the 
scheduler's `--executor-termination-grace-period`. Raise both if tasks can run 
longer.
   
   The result service image from #2577 already `exec`s its binary. Whichever of 
the two PRs lands second can give that image tini too.
   
   ## Are there any user-facing changes?
   
   Yes:
   - **Executors** drain their running tasks on SIGTERM.
   - **The scheduler, standalone and CLI containers** stop promptly on SIGTERM.
   - **New entrypoint:** the images include tini, and their entrypoint is now 
`/usr/bin/tini -- /root/<component>-entrypoint.sh`.
   - **Overridden entrypoints:** deployments that override the entrypoint, for 
example with a Kubernetes `command:`, run without tini.
   
   ## How was this tested?
   
   - `shellcheck` passes on every changed script.
   - The standalone entrypoint's stop logic was exercised with stand-in 
processes:
     - on SIGTERM, the executor drains before the scheduler stops
     - the executor's exit status is passed on
     - a SIGTERM during startup stops the scheduler cleanly.
   - The reproduction in #2589 uses the same `ubuntu:26.04` base and entrypoint 
shape. Without `exec`, `docker stop` never reaches the process, which is 
SIGKILLed (exit 137). With `exec`, the process gets SIGTERM and stops straight 
away. Under `docker run --init`, which uses tini, a process with no SIGTERM 
handler exits on SIGTERM straight away (exit 143).
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to