jina.peapods.runtimes.grpc package

Module contents

class jina.peapods.runtimes.grpc.GRPCDataRuntime(args, cancel_event=None, **kwargs)[source]

Bases: jina.peapods.runtimes.zmq.asyncio.AsyncNewLoopRuntime, abc.ABC

Runtime procedure leveraging Grpclet for sending DataRequests

Initialize grpc and data request handling. :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

async async_run_forever()[source]

Start the grpclet

async async_teardown()[source]

Close the data request handler and stop sending messages

async async_cancel()[source]

The async method to stop server.

static get_control_address(**kwargs)[source]

Does return None, exists for keeping interface compatible with ZEDRuntime

Parameters

kwargs – extra keyword arguments

Returns

None

static is_ready(ctrl_address, **kwargs)[source]

Check if status is ready.

Parameters
  • ctrl_address (str) – the address where the control message needs to be sent

  • kwargs – extra keyword arguments

Return type

bool

Returns

True if status is ready else False.

static wait_for_ready_or_shutdown(timeout, ctrl_address, shutdown_event, **kwargs)[source]

Check if the runtime has successfully started

Parameters
  • timeout (Optional[float]) – The time to wait before readiness or failure is determined

  • ctrl_address (str) – the address where the control message needs to be sent

  • shutdown_event (Union[Event, Event]) – the multiprocessing event to detect if the process failed

  • kwargs – extra keyword arguments

Returns

True if is ready or it needs to be shutdown