jina.peapods.pods¶
-
class
jina.peapods.pods.
BasePod
(args, needs=None)[source]¶ Bases:
contextlib.ExitStack
A BasePod is a immutable set of peas, which run in parallel. They share the same input and output socket. Internally, the peas can run with the process/thread backend. They can be also run in their own containers
- Parameters
args (
Union
[Namespace
,Dict
]) – arguments parsed from the CLI
-
needs
= None¶ used in the
jina.flow.Flow
to build the graph
-
property
role
¶ - Return type
-
property
is_singleton
¶ Return if the Pod contains only a single Pea
- Return type
bool
-
property
port_expose
¶ Get the grpc port number
- Return type
int
-
property
host
¶ Get the host name of this Pod
- Return type
str
-
property
host_in
¶ Get the host_in of this pod
- Return type
str
-
property
host_out
¶ Get the host_out of this pod
- Return type
str
-
property
address_in
¶ Get the full incoming address of this pod
- Return type
str
-
property
address_out
¶ Get the full outgoing address of this pod
- Return type
str
-
property
first_pea_args
¶ Return the first non-head/tail pea’s args
- Return type
Namespace
-
property
head_args
¶ Get the arguments for the head of this BasePod.
-
property
tail_args
¶ Get the arguments for the tail of this BasePod.
-
property
all_args
¶ Get all arguments of all Peas in this BasePod.
- Return type
List
[Namespace
]
-
property
num_peas
¶ Get the number of running
BasePea
- Return type
int
-
start
()[source]¶ Start to run all Peas in this BasePod.
Remember to close the BasePod with
close()
.Note that this method has a timeout of
timeout_ready
set in CLI, which is inherited fromjina.peapods.peas.BasePea
- Return type
-
connect_to_tail_of
(pod)[source]¶ Eliminate the head node by connecting prev_args node directly to peas
-
connect_to_head_of
(pod)[source]¶ Eliminate the tail node by connecting next_args node directly to peas
-
property
is_ready
¶ A Pod is ready when all the Peas it contains are ready
- Return type
bool