Skip to content

Commit

Permalink
Logging fixes. (skypilot-org#1452)
Browse files Browse the repository at this point in the history
* Logging fixes.

* yapf

* sys.exit(1)
  • Loading branch information
concretevitamin authored and Sumanth committed Jan 15, 2023
1 parent 5ad49cb commit 0a5e8b4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
13 changes: 10 additions & 3 deletions sky/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1025,8 +1025,11 @@ def _add_command_alias_to_group(group, command, name, hidden):
new_command = copy.deepcopy(command)
new_command.hidden = hidden
new_command.name = name
new_command.invoke = _with_deprecation_warning(new_command.invoke,
command.name, name)

orig = f'sky {group.name} {command.name}'
alias = f'sky {group.name} {name}'
new_command.invoke = _with_deprecation_warning(new_command.invoke, orig,
alias)
group.add_command(new_command, name=name)


Expand Down Expand Up @@ -3078,7 +3081,11 @@ def spot_cancel(name: Optional[str], job_ids: Tuple[int], all: bool, yes: bool):
@usage_lib.entrypoint
def spot_logs(name: Optional[str], job_id: Optional[int], follow: bool):
"""Tail the log of a managed spot job."""
core.spot_tail_logs(name=name, job_id=job_id, follow=follow)
try:
core.spot_tail_logs(name=name, job_id=job_id, follow=follow)
except exceptions.ClusterNotUpError:
# Hint messages already printed by the call above.
sys.exit(1)


# ==============================
Expand Down
6 changes: 3 additions & 3 deletions sky/spot/recovery_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ def _try_cancel_all_jobs(self):
except Exception as e: # pylint: disable=broad-except
# Ignore the failure as the cluster can be totally stopped, and the
# job canceling can get connection error.
logger.info(
f'Ignoring the job cancellation failure (Exception: {e}); '
'the spot cluster is likely completely stopped.')
logger.info('Ignoring the job cancellation failure; '
'the spot cluster is likely completely stopped.'
f'\n Detailed exception: {e}')

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

0 comments on commit 0a5e8b4

Please sign in to comment.