Skip to content

Commit

Permalink
Fix creating $PWD/~/sky_logs in some cases. (#2009)
Browse files Browse the repository at this point in the history
  • Loading branch information
concretevitamin committed Jun 3, 2023
1 parent 44891ac commit 806f585
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions sky/backends/cloud_vm_ray_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ def _retry_zones(
# Get log_path name
log_path = os.path.join(self.log_dir, 'provision.log')
log_abs_path = os.path.abspath(log_path)
os.makedirs(self.log_dir, exist_ok=True)
os.makedirs(os.path.expanduser(self.log_dir), exist_ok=True)
os.system(f'touch {log_path}')
tail_cmd = f'tail -n100 -f {log_path}'
logger.info('To view detailed progress: '
Expand Down Expand Up @@ -2118,6 +2118,8 @@ class CloudVmRayBackend(backends.Backend['CloudVmRayResourceHandle']):

def __init__(self):
self.run_timestamp = backend_utils.get_run_timestamp()
# NOTE: do not expanduser() here, as this '~/...' path is used for
# remote as well to be expanded on the remote side.
self.log_dir = os.path.join(constants.SKY_LOGS_DIRECTORY,
self.run_timestamp)
# Do not make directories to avoid create folder for commands that
Expand Down Expand Up @@ -2514,7 +2516,7 @@ def _sync_workdir_node(runner: command_runner.SSHCommandRunner) -> None:
f'{style.BRIGHT}{workdir}{style.RESET_ALL}'
f' -> '
f'{style.BRIGHT}{SKY_REMOTE_WORKDIR}{style.RESET_ALL}')
os.makedirs(self.log_dir, exist_ok=True)
os.makedirs(os.path.expanduser(self.log_dir), exist_ok=True)
os.system(f'touch {log_path}')
tail_cmd = f'tail -n100 -f {log_path}'
logger.info('To view detailed progress: '
Expand Down Expand Up @@ -3527,8 +3529,10 @@ def _setup_tpu_name_on_node(

def _execute_file_mounts(self, handle: CloudVmRayResourceHandle,
file_mounts: Dict[Path, Path]):
"""Executes file mounts - rsyncing local files and
copying from remote stores."""
"""Executes file mounts.
Rsyncing local files and copying from remote stores.
"""
# File mounts handling for remote paths possibly without write access:
# (1) in 'file_mounts' sections, add <prefix> to these target paths.
# (2) then, create symlinks from '/.../file' to '<prefix>/.../file'.
Expand Down Expand Up @@ -3565,7 +3569,7 @@ def _execute_file_mounts(self, handle: CloudVmRayResourceHandle,
f'{fore.YELLOW}Source path {src!r} is a symlink. '
f'Symlink contents are not uploaded.{style.RESET_ALL}')

os.makedirs(self.log_dir, exist_ok=True)
os.makedirs(os.path.expanduser(self.log_dir), exist_ok=True)
os.system(f'touch {log_path}')
tail_cmd = f'tail -n100 -f {log_path}'
logger.info('To view detailed progress: '
Expand Down

0 comments on commit 806f585

Please sign in to comment.