Skip to content

Commit e889fc0

Browse files
Logging fixes. (skypilot-org#1452)
* Logging fixes. * yapf * sys.exit(1)
1 parent 30476aa commit e889fc0

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

sky/cli.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -1025,8 +1025,11 @@ def _add_command_alias_to_group(group, command, name, hidden):
10251025
new_command = copy.deepcopy(command)
10261026
new_command.hidden = hidden
10271027
new_command.name = name
1028-
new_command.invoke = _with_deprecation_warning(new_command.invoke,
1029-
command.name, name)
1028+
1029+
orig = f'sky {group.name} {command.name}'
1030+
alias = f'sky {group.name} {name}'
1031+
new_command.invoke = _with_deprecation_warning(new_command.invoke, orig,
1032+
alias)
10301033
group.add_command(new_command, name=name)
10311034

10321035

@@ -3031,7 +3034,11 @@ def spot_cancel(name: Optional[str], job_ids: Tuple[int], all: bool, yes: bool):
30313034
@usage_lib.entrypoint
30323035
def spot_logs(name: Optional[str], job_id: Optional[int], follow: bool):
30333036
"""Tail the log of a managed spot job."""
3034-
core.spot_tail_logs(name=name, job_id=job_id, follow=follow)
3037+
try:
3038+
core.spot_tail_logs(name=name, job_id=job_id, follow=follow)
3039+
except exceptions.ClusterNotUpError:
3040+
# Hint messages already printed by the call above.
3041+
sys.exit(1)
30353042

30363043

30373044
# ==============================

sky/spot/recovery_strategy.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ def _try_cancel_all_jobs(self):
123123
except Exception as e: # pylint: disable=broad-except
124124
# Ignore the failure as the cluster can be totally stopped, and the
125125
# job canceling can get connection error.
126-
logger.info(
127-
f'Ignoring the job cancellation failure (Exception: {e}); '
128-
'the spot cluster is likely completely stopped.')
126+
logger.info('Ignoring the job cancellation failure; '
127+
'the spot cluster is likely completely stopped.'
128+
f'\n Detailed exception: {e}')
129129

130130
def _launch(self, max_retry=3, raise_on_failure=True) -> Optional[float]:
131131
"""Implementation of launch().

0 commit comments

Comments
 (0)