jina.peapods.runtimes.zmq.zed module

class jina.peapods.runtimes.zmq.zed.ZEDRuntime(args, **kwargs)[source]

Bases: jina.peapods.runtimes.zmq.base.ZMQRuntime

Runtime procedure leveraging ZmqStreamlet for Executor.

Initialize private parameters and execute private loading functions.

Parameters
  • args (Namespace) – args from CLI

  • kwargs – extra keyword arguments

run_forever()[source]

Start the ZmqStreamlet.

teardown()[source]

Close the ZmqStreamlet and Executor.

property is_idle: bool

Return True when current time is max_idle_time seconds late than the last active time

Return type

bool

Returns

True if idle else false.

static status(ctrl_address, timeout_ctrl)[source]

Send get status control message.

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

  • timeout_ctrl (int) – the timeout to wait for control messages to be processed

Returns

control message.

static is_ready(ctrl_address, timeout_ctrl)[source]

Check if status is ready.

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

  • timeout_ctrl (int) – the timeout to wait for control messages to be processed

Return type

bool

Returns

True if status is ready else False.

static wait_for_ready_or_shutdown(timeout, ctrl_address, timeout_ctrl, 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

  • timeout_ctrl (int) – the timeout to wait for control messages to be processed

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

  • kwargs – extra keyword arguments

Returns

True if is ready or it needs to be shutdown

static cancel(control_address, timeout_ctrl, socket_in_type, skip_deactivate, logger, **kwargs)[source]

Check if the runtime has successfully started

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

  • timeout_ctrl (int) – the timeout to wait for control messages to be processed

  • socket_in_type (SocketType) – the type of input socket, needed to know if is a dealer

  • skip_deactivate (bool) – flag to tell if deactivate signal may be missed. This is important when you want to independently kill a Runtime

  • logger (JinaLogger) – the JinaLogger to log messages

  • kwargs – extra keyword arguments

static activate(control_address, timeout_ctrl, socket_in_type, logger, **kwargs)[source]

Check if the runtime has successfully started

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

  • timeout_ctrl (int) – the timeout to wait for control messages to be processed

  • socket_in_type (SocketType) – the type of input socket, needed to know if is a dealer

  • logger (JinaLogger) – the JinaLogger to log messages

  • kwargs – extra keyword arguments

static get_control_address(host, port, **kwargs)[source]

Get the control address for a runtime with a given host and port

Parameters
  • host (str) – the host where the runtime works

  • port (str) – the control port where the runtime listens

  • kwargs – extra keyword arguments

Returns

The corresponding control address