class_docstr: A future-like object wrapping the result of a unary deployment handle call.
  
  From inside a deployment, a `DeploymentResponse` can be awaited to retrieve the
  output of the call without blocking the asyncio event loop.
  
  From outside a deployment, `.result()` can be used to retrieve the output in a
  blocking manner.
  
  Example:
  
  .. code-block:: python
  
      from ray import serve
      from ray.serve.handle import DeploymentHandle
  
      @serve.deployment
      class Downstream:
          def say_hi(self, message: str) -> str:
              return f"Hello {message}!"
  
      @serve.deployment
      class Caller:
          def __init__(self, handle: DeploymentHandle):
              self._downstream_handle = handle
  
      async def __call__(self, message: str) -> str:
          # Inside a deployment: `await` the result to enable concurrency.
          response = self._downstream_handle.say_hi.remote(message)
          return await response
  
      app = Caller.bind(Downstream.bind())
      handle: DeploymentHandle = serve.run(app)
  
      # Outside a deployment: call `.result()` to get output.
      response = handle.remote("world")
      assert response.result() == "Hello world!"
  
  A `DeploymentResponse` can be passed directly to another `DeploymentHandle` call
  without fetching the result to enable composing multiple deployments together.
  
  Example:
  
  .. code-block:: python
  
      from ray import serve
      from ray.serve.handle import DeploymentHandle
  
      @serve.deployment
      class Adder:
          def add(self, val: int) -> int:
              return val + 1
  
      @serve.deployment
      class Caller:
          def __init__(self, handle: DeploymentHandle):
              self._adder_handle = handle
  
      async def __call__(self, start: int) -> int:
          return await self._adder_handle.add.remote(
              # Pass the response directly to another handle call without awaiting.
              self._adder_handle.add.remote(start)
          )
  
      app = Caller.bind(Adder.bind())
      handle: DeploymentHandle = serve.run(app)
      assert handle.remote(0).result() == 2
class_docstr_tok: ["A","future-like","object","wrapping","the","result","of","a","unary","deployment","handle","call",".","From","inside","a","deployment",",","a","`","DeploymentResponse","`","can","be","awaited","to","retrieve","the","output","of","the","call","without","blocking","the","asyncio","event","loop",".","From","outside","a","deployment",",","`",".result","(",")","`","can","be","used","to","retrieve","the","output","in","a","blocking","manner",".","Example",":","..","code-block",":",":","python","from","ray","import","serve","from","ray.serve.handle","import","DeploymentHandle","@","serve.deployment","class","Downstream",":","def","say_hi","(","self",",","message",":","str",")","-",">","str",":","return","f","''","Hello","{","message","}","!","''","@","serve.deployment","class","Caller",":","def","__init__","(","self",",","handle",":","DeploymentHandle",")",":","self._downstream_handle","=","handle","async","def","__call__","(","self",",","message",":","str",")","-",">","str",":","#","Inside","a","deployment",":","`","await","`","the","result","to","enable","concurrency",".","response","=","self._downstream_handle.say_hi.remote","(","message",")","return","await","response","app","=","Caller.bind","(","Downstream.bind","(",")",")","handle",":","DeploymentHandle","=","serve.run","(","app",")","#","Outside","a","deployment",":","call","`",".result","(",")","`","to","get","output",".","response","=","handle.remote","(","``","world","''",")","assert","response.result","(",")","==","``","Hello","world","!","''","A","`","DeploymentResponse","`","can","be","passed","directly","to","another","`","DeploymentHandle","`","call","without","fetching","the","result","to","enable","composing","multiple","deployments","together",".","Example",":","..","code-block",":",":","python","from","ray","import","serve","from","ray.serve.handle","import","DeploymentHandle","@","serve.deployment","class","Adder",":","def","add","(","self",",","val",":","int",")","-",">","int",":","return","val","+","1","@","serve.deployment","class","Caller",":","def","__init__","(","self",",","handle",":","DeploymentHandle",")",":","self._adder_handle","=","handle","async","def","__call__","(","self",",","start",":","int",")","-",">","int",":","return","await","self._adder_handle.add.remote","(","#","Pass","the","response","directly","to","another","handle","call","without","awaiting",".","self._adder_handle.add.remote","(","start",")",")","app","=","Caller.bind","(","Adder.bind","(",")",")","handle",":","DeploymentHandle","=","serve.run","(","app",")","assert","handle.remote","(","0",")",".result","(",")","==","2"]
docstr: Yields the final result of the deployment handle call.
docstr_tok: ["Yields","the","final","result","of","the","deployment","handle","call","."]
code: def __await__(self):
      """Yields the final result of the deployment handle call."""
      obj_ref = yield from asyncio.wrap_future(self._object_ref_future)
      result = yield from obj_ref.__await__()
      return result
  
imports: import asyncio
  import concurrent.futures
  import threading
  import warnings
  from dataclasses import dataclass
  from typing import Any, AsyncIterator, Dict, Iterator, Optional, Tuple, Union
  import ray
  from ray import serve
  from ray._raylet import GcsClient, ObjectRefGenerator
  from ray.serve._private.common import DeploymentID, RequestProtocol
  from ray.serve._private.default_impl import create_cluster_node_info_cache
  from ray.serve._private.router import RequestMetadata, Router
  from ray.serve._private.usage import ServeUsageTag
  from ray.serve._private.utils import DEFAULT, get_current_actor_id, get_random_string, is_running_in_asyncio_loop
  from ray.util import metrics
  from ray.util.annotations import Deprecated, DeveloperAPI, PublicAPI
label_desc: Use image node_id 1 for calling the DeploymentResponse obj's underlying member method code with example usage: obj.__await__() and returns: result