jina.peapods.peas package

Submodules

Module contents

class jina.peapods.peas.BasePea(args)[source]

Bases: object

BasePea is a thread/process- container of BaseRuntime. It leverages threading.Thread or multiprocessing.Process to manage the lifecycle of a BaseRuntime object in a robust way.

A BasePea must be equipped with a proper Runtime class to work.

daemon

required here to set process/thread daemon

start()[source]

Start the Pea. This method calls start() in threading.Thread or multiprocesssing.Process. .. #noqa: DAR201

join(*args, **kwargs)[source]

Joins the Pea. This method calls join() in threading.Thread or multiprocesssing.Process.

Parameters
  • args – extra positional arguments to pass to join

  • kwargs – extra keyword arguments to pass to join

terminate()[source]

Terminate the Pea. This method calls terminate() in threading.Thread or multiprocesssing.Process.

activate_runtime()[source]

Send activate control message.

wait_start_success()[source]

Block until all peas starts successfully.

If not success, it will raise an error hoping the outer function to catch it

async async_wait_start_success()[source]

Block until all peas starts successfully.

If not success, it will raise an error hoping the outer function to catch it

close()[source]

Close the Pea

This method makes sure that the Process/thread is properly finished and its resources properly released

Return type

None

property role: jina.enums.PeaRoleType

Get the role of this pea in a pod

Return type

PeaRoleType