jina.peapods.pods.compoundpod

class jina.peapods.pods.compoundpod.CompoundPod(args, needs=None)[source]

Bases: jina.peapods.pods.BasePod

A CompoundPod is a immutable set of pods, which run in parallel. A CompoundPod is an abstraction using a composable pattern to abstract the usage of parallel Pods that act as replicas.

CompoundPod will make sure to add a HeadPea and a TailPea to serve as routing/merging pattern for the different Pod replicas

Parameters
  • args (Union[Namespace, Dict]) – pod arguments parsed from the CLI. These arguments will be used for each of the replicas

  • needs (Optional[Set[str]]) – pod names of preceding pods, the output of these pods are going into the input of this pod

head_args = None
tail_args = None
property port_expose

Get the grpc port number

Return type

int

property host

Get the host name of this Pod

Return type

str

property num_peas

Get the number of running Pod

Return type

int

Returns

total number of peas including head and tail

start()[source]

Start to run all Pod and Pea in this CompoundPod.

Return type

CompoundPod

Returns

started CompoundPod

Note

If one of the Pod fails to start, make sure that all of them are properly closed.

wait_start_success()[source]

Block until all pods and peas start successfully. If not successful, it will raise an error hoping the outer function to catch it

Return type

None

join()[source]

Wait until all pods and peas exit.

property is_ready

Checks if Pod is read. :rtype: bool :return: true if the peas and pods are ready to serve requests

Note

A Pod is ready when all the Peas it contains are ready

rolling_update(dump_path=None)[source]

Reload all Pods of this Compound Pod.

Parameters

dump_path (Optional[str]) – the dump from which to read the data