Skip to content

Commit

Permalink
messages decode
Browse files Browse the repository at this point in the history
  • Loading branch information
andylizf committed Oct 16, 2024
1 parent 21a933e commit bb36473
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
17 changes: 9 additions & 8 deletions sky/serve/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,15 @@ async def terminate_replica(

self._replica_manager.scale_down(replica_id, purge=purge)

message = (f'Replica {replica_id} of service '
f'{self._service_name!r} is scheduled to be ')
return responses.JSONResponse(
status_code=200,
content={
'message': message +
'terminated.' if not purge else 'purged.'
})
action = 'terminated' if not purge else 'purged'
message = (f'{colorama.Fore.GREEN}Replica {replica_id} of service '
f'{self._service_name!r} is scheduled to be '
f'{action}.{colorama.Style.RESET_ALL}\n'
f'Please use {ux_utils.BOLD}sky serve status '
f'{self._service_name} {ux_utils.RESET_BOLD}'
f' to check the latest status.')
return responses.JSONResponse(status_code=200,
content={'message': message})

@self._app.exception_handler(Exception)
async def validation_exception_handler(
Expand Down
9 changes: 2 additions & 7 deletions sky/serve/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,13 +547,8 @@ def terminate_replica(service_name: str, replica_id: int, purge: bool) -> None:
except exceptions.CommandError as e:
raise RuntimeError(e.error_msg) from e

sky_logging.print(stdout)

logger.info(
f'{colorama.Fore.GREEN}Termination of replica {replica_id} for '
f'{service_name!r} has been scheduled.{colorama.Style.RESET_ALL}\n'
f'Please use {ux_utils.BOLD}sky serve status {service_name} '
f'{ux_utils.RESET_BOLD}to check the latest status.')
message = common_utils.decode_payload(stdout)
sky_logging.print(message)


@usage_lib.entrypoint
Expand Down

0 comments on commit bb36473

Please sign in to comment.