Skip to content

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

Merged
speriaswamy-amd merged 3 commits into
mainfrom
surya/aorta-mn-01-teardown
Sep 11, 2026
Merged

speriaswamy-amd merged 3 commits into
mainfrom
surya/aorta-mn-01-teardown

Conversation

@speriaswamy-amd

Copy link
Copy Markdown
Collaborator

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.

Comment thread cvs/runners/_base_runner.py Outdated
speriaswamy-amd and others added 3 commits September 10, 2026 19:09
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>
branches: ['*'] does not cross '/' in GitHub Actions glob matching, so
pull_request events targeting a namespaced branch (e.g. surya/foo) never
triggered this workflow. Use '**' which matches across path segments.
_setup_complete was only set after setup() returned, so an exception
raised inside setup() (after it had already created resources) skipped
the finally block's teardown call entirely, reintroducing the leak
this lifecycle was meant to close. Set the flag in a finally around
the setup() call so it always fires.
@speriaswamy-amd
speriaswamy-amd force-pushed the surya/aorta-mn-01-teardown branch from c3cfd3e to 6c5fae5 Compare September 10, 2026 23:13

@amd-droy amd-droy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.thanks

@speriaswamy-amd
speriaswamy-amd removed this pull request from stack #333 September 11, 2026 00:23
@speriaswamy-amd
speriaswamy-amd added this pull request to stack #414 September 11, 2026 00:23
@speriaswamy-amd
speriaswamy-amd merged commit 519fb88 into main Sep 11, 2026
2 checks passed
@cijohnson
cijohnson deleted the surya/aorta-mn-01-teardown branch September 15, 2026 00:08
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.

2 participants