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

Fix a bug when touching logfile #1913

Merged
merged 1 commit into from
May 1, 2023
Merged
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
9 changes: 6 additions & 3 deletions sky/backends/cloud_vm_ray_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1196,10 +1196,11 @@ 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.system(f'touch {log_path}')
tail_cmd = f'tail -n100 -f {log_path}'
logger.info('To view detailed progress: '
f'{style.BRIGHT}{tail_cmd}{style.RESET_ALL}')
os.system(f'touch {log_abs_path}')

# Get previous cluster status
cluster_exists = prev_cluster_status is not None
Expand Down Expand Up @@ -2488,10 +2489,11 @@ 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.system(f'touch {log_path}')
tail_cmd = f'tail -n100 -f {log_path}'
logger.info('To view detailed progress: '
f'{style.BRIGHT}{tail_cmd}{style.RESET_ALL}')
os.system(f'touch {log_path}')
with log_utils.safe_rich_status('[bold cyan]Syncing[/]'):
subprocess_utils.run_in_parallel(_sync_workdir_node, runners)

Expand Down Expand Up @@ -3493,10 +3495,11 @@ 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.system(f'touch {log_path}')
tail_cmd = f'tail -n100 -f {log_path}'
logger.info('To view detailed progress: '
f'{style.BRIGHT}{tail_cmd}{style.RESET_ALL}')
os.system(f'touch {log_path}')

for dst, src in file_mounts.items():
# TODO: room for improvement. Here there are many moving parts
Expand Down