jina.peapods.pods.compound module

class jina.peapods.pods.compound.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 shards.

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

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

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


used in the jina.flow.Flow to build the graph

head_args = None
tail_args = None

Assign shards to the CompoundPod

property port_jinad: int

Get the JinaD remote port

Return type


property host: str

Get the host name of this Pod

Return type


property num_peas: int

Get the number of running Pod

Return type



total number of peas including head and tail


Start to run all Pod and Pea in this CompoundPod.

Return type



started CompoundPod


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


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



Wait until all pods and peas exit.

property is_ready: bool

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


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

async rolling_update(dump_path=None, *, uses_with=None)[source]

Reload all Pods of this Compound Pod. :type dump_path: Optional[str] :param dump_path: backwards compatibility This function was only accepting dump_path as the only potential arg to override :type uses_with: Optional[Dict] :param uses_with: a Dictionary of arguments to restart the executor with

async scale(replicas)[source]

Scale the amount of replicas of a given Executor.


replicas (int) – The number of replicas to scale to