jina.drivers.control

class jina.drivers.control.BaseControlDriver(priority=0, *args, **kwargs)[source]

Bases: jina.drivers.BaseDriver

Control driver does not have access to the executor and it often works directly with protobuf layer instead Jina primitive types

property envelope

Get the current request, shortcut to self.runtime.message

Return type

EnvelopeProto

runtime: Optional[ZEDRuntime]
class jina.drivers.control.LogInfoDriver(key='request', json=True, *args, **kwargs)[source]

Bases: jina.drivers.control.BaseControlDriver

Log output the request info

Parameters
  • key (str) – (str) that represents a first level or nested key in the dict

  • json (bool) – (bool) indicating if the log output should be formatted as json

  • args – additional positional arguments which are just used for the parent initialization

  • kwargs – additional key value arguments which are just used for the parent initialization

runtime: Optional[ZEDRuntime]
class jina.drivers.control.WaitDriver(priority=0, *args, **kwargs)[source]

Bases: jina.drivers.control.BaseControlDriver

Wait for some seconds, mainly for demo purpose

runtime: Optional[ZEDRuntime]
class jina.drivers.control.ControlReqDriver(priority=0, *args, **kwargs)[source]

Bases: jina.drivers.control.BaseControlDriver

Handling the control request, by default it is installed for all jina.peapods.peas.BasePea

runtime: Optional[ZEDRuntime]
class jina.drivers.control.RouteDriver(raise_no_dealer=False, *args, **kwargs)[source]

Bases: jina.drivers.control.ControlReqDriver

Ensures that data requests are forwarded to the downstream :class:`BasePea ensuring

that the load is balanced between parallel :class:`BasePea if the scheduling :class:`SchedulerType is LOAD_BALANCE.

Note

  • The dealer never receives a control request from the router,

every time it finishes a job and sends via out_sock, it returns the envelope with control request idle back to the router. The dealer also sends control request idle to the router when it first starts.

  • The router receives requests from both dealer and upstream pusher.

if it is an upstream request, use LB to schedule the receiver, mark it in the envelope if it is a control request in

Parameters
  • raise_no_dealer (bool) – raise a RuntimeError when no available dealer

  • args – additional positional arguments which are just used for the parent initialization

  • kwargs – additional key value arguments which are just used for the parent initialization

runtime: Optional[ZEDRuntime]
class jina.drivers.control.ForwardDriver(raise_no_dealer=False, *args, **kwargs)[source]

Bases: jina.drivers.control.RouteDriver

Alias to RouteDriver

runtime: Optional[ZEDRuntime]
class jina.drivers.control.WhooshDriver(priority=0, *args, **kwargs)[source]

Bases: jina.drivers.control.BaseControlDriver

Play a whoosh! sound

runtime: Optional[ZEDRuntime]