fix(runner): tear down resources after a partially-successful setup - #326
Open
speriaswamy-amd wants to merge 1 commit into
Open
fix(runner): tear down resources after a partially-successful setup#326speriaswamy-amd wants to merge 1 commit into
speriaswamy-amd wants to merge 1 commit into
Conversation
BaseRunner.execute() only set _setup_complete after setup() returned True, so the finally block's teardown() was skipped whenever setup() failed. A multi-node setup that launched containers on nodes 0..N-1 before failing on node N therefore leaked every container it had already created. Set _setup_complete as soon as setup() has been attempted, so teardown() runs for partial setups too. teardown() implementations already tolerate being called with partially-populated state. Adds cvs/runners/unittests/ (the package had no unit tests) with four cases pinning the lifecycle: teardown after success, after setup failure, after run() raises, and not before setup is attempted. Co-Authored-By: Claude <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.
Stack 1/6 — splits #171 into reviewable pieces. Base:
main.Why
BaseRunner.execute()only set_setup_completeaftersetup()returnedTrue, so thefinallyblock'steardown()was skipped whenever setup failed. A multi-node setup that launched containers on nodes 0..N-1 before failing on node N leaked every container it had already created.What changed
cvs/runners/_base_runner.py— set_setup_completeas soon assetup()has been attempted, so teardown runs for partial setups. Existingteardown()implementations already tolerate partially-populated state.cvs/runners/unittests/— new package (cvs/runners/had no unit tests); 4 cases pinning the lifecycle..gitignore— add.venv/.Test
ruff check/ruff format --checkclean. Unit tests 585 → 589.