Skip to content

Commit

Permalink
fix jobs logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Michaelvll committed Dec 12, 2024
1 parent bc4a42e commit bdfeb11
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sky/jobs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def stream_logs_by_id(job_id: int, follow: bool = True) -> str:
f'{managed_job_state.get_failure_reason(job_id)}')
log_file = managed_job_state.get_local_log_file(job_id, None)
if log_file is not None:
with open(log_file, 'r', encoding='utf-8') as f:
with open(os.path.expanduser(log_file), 'r', encoding='utf-8') as f:
# Stream the logs to the console without reading the whole
# file into memory.
start_streaming = False
Expand Down
4 changes: 2 additions & 2 deletions sky/utils/controller_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def download_and_stream_latest_job_log(
This function is only used by jobs controller and sky serve controller.
"""
os.makedirs(local_dir, exist_ok=True)
os.makedirs(os.path.expanduser(local_dir), exist_ok=True)
log_file = None
try:
log_dirs = backend.sync_down_logs(
Expand All @@ -338,7 +338,7 @@ def download_and_stream_latest_job_log(
# TODO(zhwu): refactor this into log_utils, along with the
# refactoring for the log_lib.tail_logs.
try:
with open(log_file, 'r', encoding='utf-8') as f:
with open(os.path.expanduser(log_file), 'r', encoding='utf-8') as f:
# Stream the logs to the console without reading the whole
# file into memory.
start_streaming = False
Expand Down

0 comments on commit bdfeb11

Please sign in to comment.