jina.enums module#

Miscellaneous enums used in Jina.

To use these enums in YAML config, following the example below:

chunk_idx:
  uses: index/chunk.yml
  parallel: ${{PARALLEL}}
  parallel_type: !PollingType ANY
  # or
  parallel_type: ANY
  # or
  parallel_type: any
class jina.enums.EnumType(*args, **kwargs)[source]#

Bases: enum.EnumMeta

The metaclass for BetterEnum.

Register a new EnumType

Parameters
  • args – args passed to super()

  • kwargs – kwargs passed to super()

Returns

the registry class

static register_class(cls)[source]#

Register the class for dumping loading.

Parameters

cls – Target class.

Returns

Registered class.

mro()#

Return a type’s method resolution order.

class jina.enums.BetterEnum(value)[source]#

Bases: enum.IntEnum

The base class of Enum used in Jina.

classmethod from_string(s)[source]#

Parse the enum from a string.

Parameters

s (str) – string representation of the enum value

Returns

enum value

class jina.enums.PollingType(value)[source]#

Bases: jina.enums.BetterEnum

The enum for representing the parallel type of pods in a deployment.

ANY = 1#

one of the shards will receive the message

ALL = 2#

all shards will receive the message, blocked until all done with the message

ALL_ASYNC = 3#

(reserved) all replica will receive the message, but any one of them can return, useful in backup

property is_push: bool#

Check if PollingType is using push protocol.

Return type

bool

Returns

True if this PollingType is using push protocol else False.

property is_block: bool#

Check if PollingType is using block protocol.

Return type

bool

Returns

True if this PollingType is requiring block protocol else False.

class jina.enums.LogVerbosity(value)[source]#

Bases: jina.enums.BetterEnum

Verbosity level of the logger.

DEBUG = 10#
INFO = 20#
SUCCESS = 25#
WARNING = 30#
ERROR = 40#
CRITICAL = 50#
class jina.enums.FlowBuildLevel(value)[source]#

Bases: jina.enums.BetterEnum

The enum for representing a flow’s build level.

Some jina.orchestrate.flow.Flow class functions require certain build level to run.

EMPTY = 0#

Nothing is built

GRAPH = 1#

The underlying graph is built, you may visualize the flow

RUNNING = 2#

the graph is started and all deployment are running

class jina.enums.GatewayProtocolType(value)[source]#

Bases: jina.enums.BetterEnum

Gateway communication protocol

GRPC = 0#
HTTP = 1#
WEBSOCKET = 2#
class jina.enums.PodRoleType(value)[source]#

Bases: jina.enums.BetterEnum

The enum of a Pod role.

HEAD = 0#
WORKER = 1#
GATEWAY = 2#
class jina.enums.DeploymentRoleType(value)[source]#

Bases: jina.enums.BetterEnum

The enum of a Deploymen role for visualization.

DEPLOYMENT = 0#
JOIN = 1#
INSPECT = 2#
GATEWAY = 3#
INSPECT_AUX_PASS = 4#
JOIN_INSPECT = 5#
property is_inspect: bool#

If the role is inspect deployment related.

Return type

bool

Returns

True if the Deployment role is inspect related else False.

class jina.enums.FlowInspectType(value)[source]#

Bases: jina.enums.BetterEnum

Inspect strategy in the flow.

HANG = 0#
REMOVE = 1#
COLLECT = 2#
property is_keep: bool#

Check if the target is inspected.

Return type

bool

Returns

True if the target is inspected else False.

class jina.enums.DataInputType(value)[source]#

Bases: jina.enums.BetterEnum

Data input type in the request generator.

AUTO = 0#
DOCUMENT = 1#
CONTENT = 2#
DICT = 3#
class jina.enums.WebsocketSubProtocols(value)[source]#

Bases: str, enum.Enum

Subprotocol supported with Websocket Gateway

JSON = 'json'#
BYTES = 'bytes'#
jina.enums.replace_enum_to_str(obj)[source]#

Transform BetterEnum type into string.

Parameters

obj – Target obj.

Returns

Transformed obj with string type values.