Skip to content

Commit 699a33b

Browse files
daiping8peterxcli
authored andcommitted
[Serve][Add] Include custom autoscaling policy name in logs (ray-project#57878)
## Description Now, we hava custom autoscaling policy name in logs. 1. Deployment level Test code from https://docs.ray.io/en/master/serve/advanced-guides/advanced-autoscaling.html#custom-policy-for-deployment <img width="1333" height="294" alt="image" src="https://github.com/user-attachments/assets/bd26e576-fd3c-489b-94c2-4c11b25bb400" /> 2. Application level Test code from https://docs.ray.io/en/master/serve/advanced-guides/advanced-autoscaling.html#application-level-autoscaling <img width="1321" height="431" alt="image" src="https://github.com/user-attachments/assets/d51f4952-faf5-47eb-80d0-6be357437505" /> ## Related issues Closes ray-project#57846 ## Additional information Signed-off-by: daiping8 <dai.ping88@zte.com.cn> Signed-off-by: peterxcli <peterxcli@gmail.com>
1 parent 64ada5b commit 699a33b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

python/ray/serve/_private/autoscaling_state.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ def register(self, info: DeploymentInfo, curr_target_num_replicas: int) -> int:
8181
self._target_capacity_direction = info.target_capacity_direction
8282
self._policy_state = {}
8383

84+
# Log when custom autoscaling policy is used for deployment
85+
if not self._config.policy.is_default_policy_function():
86+
logger.info(
87+
f"Using custom autoscaling policy '{self._config.policy.policy_function}' "
88+
f"for deployment '{self._deployment_id}'."
89+
)
90+
8491
return self.apply_bounds(target_num_replicas)
8592

8693
def on_replica_stopped(self, replica_id: ReplicaID):
@@ -672,6 +679,13 @@ def register(
672679
self._policy = autoscaling_policy.get_policy()
673680
self._policy_state = {}
674681

682+
# Log when custom autoscaling policy is used for application
683+
if not autoscaling_policy.is_default_policy_function():
684+
logger.info(
685+
f"Using custom autoscaling policy '{autoscaling_policy.policy_function}' "
686+
f"for application '{self._app_name}'."
687+
)
688+
675689
def has_policy(self) -> bool:
676690
return self._policy is not None
677691

0 commit comments

Comments
 (0)