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] Overwrite files on restore (replace instead of rename) #28404

Merged
merged 1 commit into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/ray/tune/impl/tuner_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def _restore_from_path_or_uri(
self._setup_create_experiment_checkpoint_dir(self._run_config)
)
for file_dir in experiment_checkpoint_path.glob("*"):
file_dir.rename(new_exp_path / file_dir.name)
file_dir.replace(new_exp_path / file_dir.name)
shutil.rmtree(experiment_checkpoint_path)
self._experiment_checkpoint_dir = str(new_exp_path)

Expand Down
4 changes: 4 additions & 0 deletions python/ray/tune/tests/test_tuner_restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,10 @@ def test_tuner_restore_from_cloud(ray_start_2_cpus, tmpdir):
# Contents changed
assert prev_lstat.st_size != after_lstat.st_size

# Overwriting should work
tuner3 = Tuner.restore("memory:///test/restore/exp_dir")
tuner3.fit()


if __name__ == "__main__":
import sys
Expand Down