Skip to content

Make it possible to define the root temporary directory for composer #3784

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mshtelma
Copy link

Make it possible to define the root temporary directory for composer

What does this PR do?

Checkpoints can become very large, and sometimes the temporary file system doesn't have enough disk space to accommodate them. This PR introduces the ability to use the TMPDIR environment variable to specify the root temporary directory. Additionally, if TMPDIR is not set and the /local_disk0 directory exists, the system will default to using /local_disk0/temp as the temporary directory.

Before submitting

  • [x ] Have you read the contributor guidelines?
  • Is this change a documentation change or typo fix? If so, skip the rest of this checklist.
  • Was this change discussed/approved in a GitHub issue first? It is much more likely to be merged if so.
  • Did you update any related docs and document your change?
  • Did you update any related tests and add any new tests related to your change? (see testing)
  • Did you run the tests locally to make sure they pass?
  • [x ] Did you run pre-commit on your change? (see the pre-commit section of prerequisites)

@@ -274,7 +274,13 @@ def __init__(

is_remote_folder = backend != ''
if is_remote_folder: # If uploading to a remote path, use a temporary directory to save local checkpoints.
local_folder = os.path.join(tempfile.mkdtemp(), local_folder)
root_temp_folder = None
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this is already how mkdtemp works? https://docs.python.org/3/library/tempfile.html#tempfile.mkdtemp. The first place it should look to decide the tmpdir folder is whatever is specified by the TMPDIR env var.

@dakinggg dakinggg requested a review from irenedea March 19, 2025 22:28
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