Install stop-signal handlers in the K8s manager CLI - #27
Open
dotsdl wants to merge 1 commit into
Open
Conversation
The 'manager start' command ran manager.start() with no signal handling. Kubernetes stops pods with SIGTERM (then SIGKILL after the grace period), which bypassed ComputeManager.start()'s finally block and orphaned the manager's ComputeManagerRegistration on every rollout/scale-down/pod deletion. It now installs SIGHUP/SIGINT/SIGTERM handlers via alchemiscale.compute.signals.install_stop_handlers, so stop() runs and the registration deregisters cleanly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
manager startcommand ranmanager.start()with no signal handling. Kubernetes terminates pods withSIGTERM(thenSIGKILLafter the grace period), so the manager process was killed without runningComputeManager.start()'sfinallyblock — orphaning itsComputeManagerRegistrationin the state store on every rollout, scale-down,kubectl delete pod, node drain, or eviction. Only an interactive SIGINT cleaned up.This wires the command to
alchemiscale.compute.signals.install_stop_handlers, which registersSIGHUP/SIGINT/SIGTERMhandlers that callmanager.stop()(now interruptible, so it wakes the inter-cycle sleep promptly) and let the loop unwind through its deregistrationfinally.Notes
exec/an init liketini) so the signal is delivered/forwarded — ash -c "..."entrypoint withoutexecwould swallow it.--stealflag remains a useful safety net for reclaiming a registration left behind by a hardSIGKILL.Dependency
Requires the
install_stop_handlershelper (and interruptible-sleep changes) added in the core repo:OpenFreeEnergy/alchemiscale#503. Merge that first.
🤖 Generated with Claude Code