Skip to content
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

[tune] Clean up temporary checkpoint directories for class trainables (ex: RLlib) #44366

Merged
merged 6 commits into from
Apr 19, 2024

Conversation

justinvyu
Copy link
Contributor

Why are these changes needed?

Class Trainables currently create a temporary directory and provides it as the argument to the user-defined save_checkpoint. The temporary checkpoint directory gets persisted to storage after the user code executes, but it never gets cleaned up after. This leads to a build-up of many checkpoint "staging" folders that need to be manually deleted. RLlib is affected due to Algorithms being class trainables.

This PR cleans up the checkpoint folders right after they've been copied to storage.

Related issue number

Closes #43092

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

# NOTE: There's no need to supply the checkpoint directory inside
# the local trial dir, since it'll get persisted to the right location.
@contextmanager
def _create_checkpoint_dir(self, checkpoint_dir: Optional[str] = None):
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this still used anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yeah I can delete this now.

Copy link
Contributor

@matthewdeng matthewdeng left a comment

Choose a reason for hiding this comment

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

yay!

@justinvyu justinvyu merged commit 5d60d8d into ray-project:master Apr 19, 2024
5 checks passed
@justinvyu justinvyu deleted the cleanup_cls_trainable_tmpdirs branch April 19, 2024 22:26
ryanaoleary pushed a commit to ryanaoleary/ray that referenced this pull request Jun 7, 2024
… (ex: RLlib) (ray-project#44366)

Clean up temporary checkpoint folders of class trainables after they've been persisted to storage.

---------

Signed-off-by: Justin Yu <[email protected]>
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.

[Tune] Logging dir duplication
2 participants