Skip to content

Commit

Permalink
Add 'TERMINATED' to ReplicaStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
landscapepainter committed Jan 6, 2024
1 parent 48a7bba commit 87e0c6c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sky/serve/replica_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ def is_scale_down_succeeded(self, initial_delay_seconds: int) -> bool:
notify the user that something is wrong with the user code / setup.
"""
logger.info('is_scale_down_succeeded(1)')
logger.info(f'is_scale_down_succeeded(self.sky_launch_status):{self.sky_launch_status}')
logger.info(f'is_scale_down_succeeded(self.sky_down_status):{self.sky_down_status}')

if self.sky_launch_status != ProcessStatus.SUCCEEDED:
logger.info('is_scale_down_succeeded(2)')
return False
Expand Down Expand Up @@ -343,6 +346,11 @@ def to_replica_status(self) -> serve_state.ReplicaStatus:
# Pending to launch
return serve_state.ReplicaStatus.PENDING
if self.sky_launch_status == ProcessStatus.RUNNING:
# replica is terminated, but the ReplicaInfo is kept as some
# failure detected.
if self.sky_down_status is not None:
if self.sky_down_status == ProcessStatus.SUCCEEDED:
return serve_state.ReplicaStatus.TERMINATED
# Still launching
return serve_state.ReplicaStatus.PROVISIONING
if self.sky_down_status is not None:
Expand Down Expand Up @@ -841,6 +849,7 @@ def _refresh_process_pool(self) -> None:
logger.info(f'Termination of replica {replica_id} '
'finished. Replica info is kept since some '
'failure detected.')
info.status_property
serve_state.add_or_update_replica(self._service_name,
replica_id, info)

Expand Down
4 changes: 4 additions & 0 deletions sky/serve/serve_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ class ReplicaStatus(enum.Enum):

# Unknown. This should never happen (used only for unexpected errors).
UNKNOWN = 'UNKNOWN'

# The replica successfully terminated, but the 'ReplicaInfo' is kept since
# some failure detected.
TERMINATED = 'TERMINATED'

@classmethod
def failed_statuses(cls) -> List['ReplicaStatus']:
Expand Down

0 comments on commit 87e0c6c

Please sign in to comment.