jina.peapods.peas¶
-
class
jina.peapods.peas.
BasePea
(args)[source]¶ Bases:
object
BasePea
is a thread/process- container ofBaseRuntime
. It leveragesthreading.Thread
ormultiprocessing.Process
to manage the lifecycle of aBaseRuntime
object in a robust way.A
BasePea
must be equipped with a properRuntime
class to work.-
runtime_cls
: Type[BaseRuntime] = None¶
-
daemon
¶ required here to set process/thread daemon
-
run
()[source]¶ Method representing the
BaseRuntime
activity.This method overrides
run()
inthreading.Thread
ormultiprocesssing.Process
.Note
run()
is running in subprocess/thread, the exception can not be propagated to the main process. Hence, please do not raise any exception here.
-
start
()[source]¶ Start the Pea.
This method overrides
start()
inthreading.Thread
ormultiprocesssing.Process
.
-
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
¶ Get the role of this pea in a pod
- Return type
-