jina.serve.runtimes.gateway.request_handling module

class jina.serve.runtimes.gateway.request_handling.RequestHandler(metrics_registry=None, runtime_name=None)[source]

Bases: object

Class that handles the requests arriving to the gateway and the result extracted from the requests future.

Parameters
  • metrics_registry (Optional[ForwardRef]) – optional metrics registry for prometheus used if we need to expose metrics from the executor or from the data request handler

  • runtime_name (Optional[str]) – optional runtime_name that will be registered during monitoring

handle_request(graph, connection_pool)[source]

Function that handles the requests arriving to the gateway. This will be passed to the streamer.

Parameters
  • graph (TopologyGraph) – The TopologyGraph of the Flow.

  • connection_pool (GrpcConnectionPool) – The connection pool to be used to send messages to specific nodes of the graph

Return type

Callable[[ForwardRef], ForwardRef]

Returns

Return a Function that given a Request will return a Future from where to extract the response

handle_result()[source]

Function that handles the result when extracted from the request future

Return type

Callable[[ForwardRef], ForwardRef]

Returns

Return a Function that returns a request to be returned to the client