jina.serve.runtimes.head package
Module contents
class jina.serve.runtimes.head.HeadRuntime(args, cancel_event=None, \*kwargs*)[source]
Bases: jina.serve.runtimes.asyncio.AsyncNewLoopRuntime, abc.ABC
Runtime is used in head pods. It responds to Gateway requests and sends to uses_before/uses_after and its workers
Initialize grpc server for the head runtime. :type args: Namespace
:param args: args from CLI :type cancel_event: Union
[Event
, Event
, Event
, None
] :param cancel_event: the cancel event used to wait for canceling :param kwargs: keyword args
DEFAULT_POLLING = 1
async async_setup()[source]
Wait for the GRPC server to start
async async_run_forever()[source]
Block until the GRPC server is terminated
async async_cancel()[source]
Stop the GRPC server
async async_teardown()[source]
Close the connection pool
async process_single_data(request, context)[source]
Process the received requests and return the result as a new request
Parameters
request (DataRequest) – the data request to process
context – grpc context
Return type
Returns
the response request
async process_data(requests, context)[source]
Process the received data request and return the result as a new request
Parameters
requests (
List
[DataRequest]) – the data requests to processcontext – grpc context
Return type
Returns
the response request
async process_control(request, \args*)[source]
Process the received control request and return the input request
Parameters
request (ControlRequest) – the data request to process
args – additional arguments in the grpc call, ignored
Return type
Returns
the input request