hunk.code_window:                 logger.warning(
                       "Legacy target_utilization_fraction config "
                       "detected. Replacing it by setting upscaling_speed to " +
                       "1 / target_utilization_fraction.")
               else:
                   upscaling_speed = 1.0
               if self.resource_demand_scheduler:
                   # The node types are autofilled internally for legacy yamls,
  
hunk.labels: keep keep keep replace keep keep keep keep
hunk.after_edit:                     "1 / target_utilization_fraction - 1.")
  
hunk.file_path: python/ray/autoscaler/_private/autoscaler.py
hunk.type: replace
file: import requests
  import random
  
  import ray
  from ray import serve
  from ray.serve import BackendConfig
  
  ray.init()
  client = serve.start()
  
  
  class Threshold:
      def __init__(self):
          # self.model won't be changed by reconfigure.
          self.model = random.Random()  # Imagine this is some heavyweight model.
  
      def reconfigure(self, config):
          # This will be called when the class is created and when
          # the user_config field of BackendConfig is updated.
          self.threshold = config["threshold"]
  
      def __call__(self, request):
          return self.model.random() > self.threshold
  
  
  backend_config = BackendConfig(user_config={"threshold": 0.01})
  client.create_backend("threshold", Threshold, config=backend_config)
  client.create_endpoint("threshold", backend="threshold", route="/threshold")
  print(requests.get("http://127.0.0.1:8000/threshold").text)  # true, probably
  
  backend_config = BackendConfig(user_config={"threshold": 0.99})
  client.update_backend_config("threshold", backend_config)
  print(requests.get("http://127.0.0.1:8000/threshold").text)  # false, probably
  