Skip to content

Commit

Permalink
update path syntax
Browse files Browse the repository at this point in the history
Signed-off-by: n3011 <[email protected]>
  • Loading branch information
n3011 committed Dec 21, 2023
1 parent 75f2c38 commit d979f76
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions python/ray/train/_checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def get_metadata(self) -> Dict[str, Any]:
If no metadata is stored, an empty dict is returned.
"""
metadata_path = Path(self.path, _METADATA_FILE_NAME).as_posix()
metadata_path = Path(self.path, _METADATA_FILE_NAME).as_posix()
if not _exists_at_fs_path(self.filesystem, metadata_path):
return {}

Expand All @@ -142,7 +142,7 @@ def set_metadata(self, metadata: Dict[str, Any]) -> None:
This will overwrite any existing metadata stored with this checkpoint.
"""
metadata_path = (Path(self.path) / _METADATA_FILE_NAME).as_posix()
metadata_path = Path(self.path, _METADATA_FILE_NAME).as_posix()
with self.filesystem.open_output_stream(metadata_path) as f:
f.write(json.dumps(metadata).encode("utf-8"))

Expand Down
8 changes: 4 additions & 4 deletions python/ray/train/_internal/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,17 +490,17 @@ def _create_validation_file(self):
storage path to verify that the storage path can be written to.
This validation file is also used to check whether the storage path is
accessible by all nodes in the cluster."""
valid_file = (
Path(self.experiment_fs_path) / _VALIDATE_STORAGE_MARKER_FILENAME
valid_file = Path(
self.experiment_fs_path, _VALIDATE_STORAGE_MARKER_FILENAME
).as_posix()
self.storage_filesystem.create_dir(self.experiment_fs_path)
with self.storage_filesystem.open_output_stream(valid_file):
pass

def _check_validation_file(self):
"""Checks that the validation file exists at the storage path."""
valid_file = (
Path(self.experiment_fs_path) / _VALIDATE_STORAGE_MARKER_FILENAME
valid_file = Path(
self.experiment_fs_path, _VALIDATE_STORAGE_MARKER_FILENAME
).as_posix()
if not _exists_at_fs_path(fs=self.storage_filesystem, fs_path=valid_file):
raise RuntimeError(
Expand Down
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 @@ -325,7 +325,7 @@ def _restore_from_path_or_uri(
storage_filesystem: Optional[pyarrow.fs.FileSystem],
):
fs, fs_path = get_fs_and_path(path_or_uri, storage_filesystem)
with fs.open_input_file((Path(fs_path) / _TUNER_PKL).as_posix()) as f:
with fs.open_input_file(Path(fs_path, _TUNER_PKL).as_posix()) as f:
tuner_state = pickle.loads(f.readall())

old_trainable_name, flattened_param_space_keys = self._load_tuner_state(
Expand Down
2 changes: 1 addition & 1 deletion python/ray/tune/tuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def train_fn(config):
bool: True if this path exists and contains the Tuner state to resume from
"""
fs, fs_path = get_fs_and_path(path, storage_filesystem)
return _exists_at_fs_path(fs, (Path(fs_path) / _TUNER_PKL).as_posix())
return _exists_at_fs_path(fs, Path(fs_path, _TUNER_PKL).as_posix())

def _prepare_remote_tuner_for_jupyter_progress_reporting(self):
run_config: RunConfig = ray.get(self._remote_tuner.get_run_config.remote())
Expand Down

0 comments on commit d979f76

Please sign in to comment.