mirror of
https://github.com/wassname/ray.git
synced 2026-07-08 14:56:07 +08:00
Change /tmp to platform-specific temporary directory (#7529)
This commit is contained in:
@@ -19,9 +19,11 @@ class MockDurableTrainable(DurableTrainable):
|
||||
def __init__(self, remote_checkpoint_dir, *args, **kwargs):
|
||||
# Mock the path as a local path.
|
||||
local_dir_suffix = remote_checkpoint_dir.split("://")[1]
|
||||
remote_checkpoint_dir = os.path.join("/tmp", local_dir_suffix)
|
||||
remote_checkpoint_dir = os.path.join(ray.utils.get_user_temp_dir(),
|
||||
local_dir_suffix)
|
||||
# Disallow malformed relative paths for delete safety.
|
||||
assert os.path.abspath(remote_checkpoint_dir).startswith("/tmp")
|
||||
assert os.path.abspath(remote_checkpoint_dir).startswith(
|
||||
ray.utils.get_user_temp_dir())
|
||||
logger.info("Using %s as the mocked remote checkpoint directory.",
|
||||
self.remote_checkpoint_dir)
|
||||
super(MockDurableTrainable, self).__init__(remote_checkpoint_dir,
|
||||
|
||||
Reference in New Issue
Block a user