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

Parameters

priority (int) – the priority of its default arg values (hardcoded in Python). If the received QueryLang has a higher priority, it will override the hardcoded value

property envelope¶

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

Return type

EnvelopeProto

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

  • args –

  • kwargs –

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

Bases: jina.drivers.control.BaseControlDriver

Wait for some seconds, mainly for demo purpose

Parameters

priority (int) – the priority of its default arg values (hardcoded in Python). If the received QueryLang has a higher priority, it will override the hardcoded value

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.runtime.BasePea

Parameters

priority (int) – the priority of its default arg values (hardcoded in Python). If the received QueryLang has a higher priority, it will override the hardcoded value

class jina.drivers.control.RouteDriver(raise_no_dealer=False, *args, **kwargs)[source]¶

Bases: jina.drivers.control.ControlReqDriver

A simple load balancer forward message to the next available pea

  • The dealer never receives a control request from the router, everytime it finishes a job and send 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 request from both dealer and upstream pusher. if it is a 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 –

  • kwargs –

class jina.drivers.control.ForwardDriver(raise_no_dealer=False, *args, **kwargs)[source]¶

Bases: jina.drivers.control.RouteDriver

Alias to RouteDriver

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

  • args –

  • kwargs –

class jina.drivers.control.ReduceDriver(raise_no_dealer=False, *args, **kwargs)[source]¶

Bases: jina.drivers.control.RouteDriver

Alias to RouteDriver

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

  • args –

  • kwargs –