docstr: Implements a generator wrapping a deployment response.
  
  Args:
      - timeout_s: an end-to-end timeout for the request. If this expires and the
        response is not completed, the request will be cancelled. If `None`,
        there's no timeout.
      - disconnected_task: a task whose completion signals that the client has
        disconnected. When this happens, the request will be cancelled. If `None`,
        disconnects will not be detected.
      - result_callback: will be called on each result before it's returned. If
        `None`, the unmodified result is returned.
docstr_tok: ["Implements","a","generator","wrapping","a","deployment","response",".","Args",":","-","timeout_s",":","an","end-to-end","timeout","for","the","request",".","If","this","expires","and","the","response","is","not","completed",",","the","request","will","be","cancelled",".","If","`","None","`",",","there","'s","no","timeout",".","-","disconnected_task",":","a","task","whose","completion","signals","that","the","client","has","disconnected",".","When","this","happens",",","the","request","will","be","cancelled",".","If","`","None","`",",","disconnects","will","not","be","detected",".","-","result_callback",":","will","be","called","on","each","result","before","it","'s","returned",".","If","`","None","`",",","the","unmodified","result","is","returned","."]
code: def __init__(
      self,
      *,
      timeout_s: Optional[float] = None,
      disconnected_task: Optional[asyncio.Task] = None,
      result_callback: Optional[Callable[[Any], Any]] = None,
  ):
      """Implements a generator wrapping a deployment response.
  
      Args:
          - timeout_s: an end-to-end timeout for the request. If this expires and the
            response is not completed, the request will be cancelled. If `None`,
            there's no timeout.
          - disconnected_task: a task whose completion signals that the client has
            disconnected. When this happens, the request will be cancelled. If `None`,
            disconnects will not be detected.
          - result_callback: will be called on each result before it's returned. If
            `None`, the unmodified result is returned.
      """
      self._timeout_s = timeout_s
      self._start_time_s = time.time()
      self._disconnected_task = disconnected_task
      self._result_callback = result_callback
  
file_path: ray/python/ray/serve/_private/proxy_response_generator.py
imports: import asyncio
  import logging
  import time
  from abc import ABC, abstractmethod
  from asyncio.tasks import FIRST_COMPLETED
  from typing import Any, Callable, Optional, Union
  from ray.serve._private.constants import SERVE_LOGGER_NAME
  from ray.serve._private.utils import calculate_remaining_timeout
  from ray.serve.handle import DeploymentResponse, DeploymentResponseGenerator
label_desc: Use image node_id 1 to create a new _ProxyResponseGeneratorBase object from inherited base classes: ABC with example: obj = _ProxyResponseGeneratorBase()