Skip to content

fix(runner): tear down resources after a partially-successful setup - #326

Open
speriaswamy-amd wants to merge 1 commit into
mainfrom
surya/aorta-mn-01-teardown
Open

fix(runner): tear down resources after a partially-successful setup#326
speriaswamy-amd wants to merge 1 commit into
mainfrom
surya/aorta-mn-01-teardown

Conversation

@speriaswamy-amd

Copy link
Copy Markdown
Contributor

Stack 1/6 — splits #171 into reviewable pieces. Base: main.

Why

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 leaked every container it had already created.

What changed

  • cvs/runners/_base_runner.py — set _setup_complete as soon as setup() has been attempted, so teardown runs for partial setups. Existing teardown() 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 --check clean. Unit tests 585 → 589.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant