Skip to content

Commit

Permalink
[SkyServe] Not add default value of {up,down}scale_delay_seconds in…
Browse files Browse the repository at this point in the history
… service spec (#2961)

fix
  • Loading branch information
cblmemo authored Jan 10, 2024
1 parent 1e53317 commit 6fd5bf2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
11 changes: 9 additions & 2 deletions sky/serve/autoscalers.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,18 @@ def __init__(self, spec: 'service_spec.SkyServiceSpec',
self.request_timestamps: List[float] = []
self.upscale_counter: int = 0
self.downscale_counter: int = 0
upscale_delay_seconds = (
spec.upscale_delay_seconds if spec.upscale_delay_seconds is not None
else constants.AUTOSCALER_DEFAULT_UPSCALE_DELAY_SECONDS)
self.scale_up_consecutive_periods: int = int(
spec.upscale_delay_seconds /
upscale_delay_seconds /
constants.AUTOSCALER_DEFAULT_DECISION_INTERVAL_SECONDS)
downscale_delay_seconds = (
spec.downscale_delay_seconds
if spec.downscale_delay_seconds is not None else
constants.AUTOSCALER_DEFAULT_DOWNSCALE_DELAY_SECONDS)
self.scale_down_consecutive_periods: int = int(
spec.downscale_delay_seconds /
downscale_delay_seconds /
constants.AUTOSCALER_DEFAULT_DECISION_INTERVAL_SECONDS)
# Target number of replicas is initialized to min replicas.
# TODO(MaoZiming): add init replica numbers in SkyServe spec.
Expand Down
13 changes: 4 additions & 9 deletions sky/serve/service_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,8 @@ def __init__(
self._max_replicas = max_replicas
self._target_qps_per_replica = target_qps_per_replica
self._post_data = post_data

self._upscale_delay_seconds = (
upscale_delay_seconds if upscale_delay_seconds is not None else
constants.AUTOSCALER_DEFAULT_UPSCALE_DELAY_SECONDS)
self._downscale_delay_seconds = (
downscale_delay_seconds if downscale_delay_seconds is not None else
constants.AUTOSCALER_DEFAULT_DOWNSCALE_DELAY_SECONDS)
self._upscale_delay_seconds = upscale_delay_seconds
self._downscale_delay_seconds = downscale_delay_seconds

@staticmethod
def from_yaml_config(config: Dict[str, Any]) -> 'SkyServiceSpec':
Expand Down Expand Up @@ -238,9 +233,9 @@ def post_data(self) -> Optional[Dict[str, Any]]:
return self._post_data

@property
def upscale_delay_seconds(self) -> int:
def upscale_delay_seconds(self) -> Optional[int]:
return self._upscale_delay_seconds

@property
def downscale_delay_seconds(self) -> int:
def downscale_delay_seconds(self) -> Optional[int]:
return self._downscale_delay_seconds

0 comments on commit 6fd5bf2

Please sign in to comment.