fix: clean up temp images created for actions with --disable-cache#3986
Draft
dtrudg wants to merge 1 commit intosylabs:mainfrom
Draft
fix: clean up temp images created for actions with --disable-cache#3986dtrudg wants to merge 1 commit intosylabs:mainfrom
dtrudg wants to merge 1 commit intosylabs:mainfrom
Conversation
376c234 to
1c0c98a
Compare
When an action (run/exec/shell...) is performed against a remote image URI then it is implicitly pulled before execution. If the cache is active, the image is pulled into the cache and executed using the image in the cache. If the cache is disabled then the image is pulled to a temporary location, and executed from there. Prior to this PR, a temporary image pulled when the cache is disabled was not being cleaned-up on exit. This means that TMPDIR space is consumed, and not released, each time singularity is run against a remote image URI with --disable-cache. This PR corrects the issue by: 1. Moving the implicit temporary image creation behaviour out of the client packages, into the CLI level. 2. Adding a new 'PullTempDir` value to launcher and engine configuration, which tracks the created temporary directory that must be cleaned-up on exit. 3. Adding code to the cleanup functions of the native runtime engine, and OCI launcher, to perform the actual deletion of the temp dir on container exit. To test, run/shell/exec containers from remote (library, docker etc.) URIs with `--disable-cache`. During execution note that there is a `/tmp/singularity-action-pull-xxxx` directory containing the image, and that it is removed on container exit. The `--debug` output contains messages detailing this. Fixes: sylabs#3940 e2e: add rudimentary action temp cleanup test
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.
When an action (run/exec/shell...) is performed against a remote image URI then it is implicitly pulled before execution.
If the cache is active, the image is pulled into the cache and executed using the image in the cache. If the cache is disabled then the image is pulled to a temporary location, and executed from there.
Prior to this PR, a temporary image pulled when the cache is disabled was not being cleaned-up on exit. This means that TMPDIR space is consumed, and not released, each time singularity is run against a remote image URI with --disable-cache.
This PR corrects the issue by:
Moving the implicit temporary image creation behaviour out of the client packages, into the CLI level.
Adding a new 'PullTempDir` value to launcher and engine configuration, which tracks the created temporary directory that must be cleaned-up on exit.
Adding code to the cleanup routines of the native runtime engine, and OCI launcher, to perform the actual deletion of the temp dir on container exit.
To test, run/shell/exec containers from remote (library, docker etc.) URIs with
--disable-cache. During execution note that there is a/tmp/singularity-action-pull-xxxxdirectory containing the image, and that it is removed on container exit. The--debugoutput contains messages detailing this. e.g.:Fixes: #3940