class_docstr: Managing autoscaling policies and the lifecycle of the scaling function calls.
class_docstr_tok: ["Managing","autoscaling","policies","and","the","lifecycle","of","the","scaling","function","calls","."]
docstr: Clips curr_target_num_replicas using the current bounds.
docstr_tok: ["Clips","curr_target_num_replicas","using","the","current","bounds","."]
code: def apply_bounds(
      self,
      curr_target_num_replicas: int,
      target_capacity: Optional[float] = None,
      target_capacity_direction: Optional[
          TargetCapacityDirection
      ] = None,
  ) -> int:
      """Clips curr_target_num_replicas using the current bounds."""
  
      upper_bound = get_capacity_adjusted_num_replicas(
          self.config.max_replicas,
          target_capacity,
      )
      lower_bound = self.get_current_lower_bound(
          target_capacity,
          target_capacity_direction,
      )
      return max(
          lower_bound, min(upper_bound, curr_target_num_replicas)
      )
  
file_path: ray/python/ray/serve/_private/autoscaling_policy.py
imports: import logging
  from typing import List, Optional
  from ray.serve._private.common import TargetCapacityDirection
  from ray.serve._private.constants import SERVE_LOGGER_NAME
  from ray.serve._private.utils import get_capacity_adjusted_num_replicas
  from ray.serve.config import AutoscalingConfig
label_desc: Use image node_id 6 for calling the AutoscalingPolicyManager obj's underlying member method code with example usage: obj.apply_bounds(curr_target_num_replicas, target_capacity, target_capacity_direction) and returns: max