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:
EnumMeta
The metaclass for BetterEnum.
Register a new EnumType
- Parameters
args – args passed to super()
kwargs – kwargs passed to super()
- Returns
the registry class
- class jina.enums.PollingType(value)[source]#
Bases:
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:
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:
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:
BetterEnum
Gateway communication protocol
- GRPC = 0#
- HTTP = 1#
- WEBSOCKET = 2#
- class jina.enums.PodRoleType(value)[source]#
Bases:
BetterEnum
The enum of a Pod role.
- HEAD = 0#
- WORKER = 1#
- GATEWAY = 2#
- class jina.enums.DeploymentRoleType(value)[source]#
Bases:
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.RequestType(value)[source]#
Bases:
BetterEnum
The enum of Client mode.
- DATA = 0#
- CONTROL = 1#
- class jina.enums.CompressAlgo(value)[source]#
Bases:
BetterEnum
The enum of Compress algorithms.
Note
LZ4 requires additional package, to install it use pip install “jina[lz4]”
- NONE = 0#
- LZ4 = 1#
- ZLIB = 2#
- GZIP = 3#
- BZ2 = 4#
- LZMA = 5#
- class jina.enums.OnErrorStrategy(value)[source]#
Bases:
BetterEnum
The level of error handling.
Warning
In theory, all methods below do not 100% guarantee the success execution on the sequel flow. If something is wrong in the upstream, it is hard to CARRY this exception and moving forward without ANY side-effect.
- IGNORE = 0#
- SKIP_HANDLE = 1#
Skip all Executors in the sequel, only pre_hook and post_hook are called
- THROW_EARLY = 2#
Immediately throw the exception, the sequel flow will not be running at all
- class jina.enums.FlowInspectType(value)[source]#
Bases:
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:
BetterEnum
Data input type in the request generator.
- AUTO = 0#
- DOCUMENT = 1#
- CONTENT = 2#
- DICT = 3#