pants icon indicating copy to clipboard operation
pants copied to clipboard

Restart dead and exited `docker_environment` containers

Open ndellosa95 opened this issue 8 months ago • 5 comments

Building on my previous PR, here's one to restart dead and exited containers in addition to missing ones.

This also applies a label to Pants-created environments containers org.pantsbuild.environment: <environment name> and will remove any pre-existing dead containers with said label upon initialization, so they still get cleaned up if you have a bad pantsd exit at some point. If there's a way we can source this information, we could even apply a second label to denote the ID of the pantsd invocation that created the container and remove any containers created by old invocations, regardless of their status. As far as I know, the only limitation to doing this now would be running multiple pants invocations concurrently.

Closes #18307

Maybe also cl0ses #20153 and partially cl0ses #21328

ndellosa95 avatar May 05 '25 13:05 ndellosa95

Tagging @huonw directly, since you reviewed my previous PR.

ndellosa95 avatar May 05 '25 13:05 ndellosa95

cl0ses

hah, nice trick 😂

huonw avatar May 06 '25 01:05 huonw

@huonw I updated the unit tests and release notes and have the docker tests down to 26.40. Is that an acceptable figure or should I try going lower still? Also, one of the CI checks failed with what I'm pretty sure is an intermittent failure but I don't have perms to rerun.

ndellosa95 avatar May 23 '25 14:05 ndellosa95

Also, one of the CI checks failed with what I'm pretty sure is an intermittent failure but I don't have perms to rerun.

I've hit the auto-merge button and kicked off a new run.

cburroughs avatar Jun 06 '25 16:06 cburroughs

Tagging @huonw again

ndellosa95 avatar Jun 10 '25 17:06 ndellosa95

Thanks for the contribution (and thanks for waiting). We've just branched for 2.28, so merging this pull request now will come out in 2.29, please move the release notes updates to docs/notes/2.29.x.md if that's appropriate.

huonw avatar Jul 02 '25 06:07 huonw

@huonw @tdyas Can one of you rerun the failed workflow? I think the node it was running on must've been pre-empted or something.

ndellosa95 avatar Jul 07 '25 17:07 ndellosa95

@huonw @tdyas Can one of you rerun the failed workflow? I think the node it was running on must've been pre-empted or something.

I'll restart it once the remaining jobs complete (or not) so any potential successes are not undone.

tdyas avatar Jul 07 '25 17:07 tdyas

Landed the PR.

@ndellosa95: Thanks again for the contribution!

tdyas avatar Jul 08 '25 02:07 tdyas

Thanks for the contribution @ndellosa95, and @tdyas for shepherding it through the final steps.

huonw avatar Jul 10 '25 05:07 huonw