jina.orchestrate.pods.container module#
- jina.orchestrate.pods.container.run(args, name, container_name, net_mode, runtime_ctrl_address, envs, is_started, is_shutdown, is_ready)[source]#
Method to be run in a process that stream logs from a Container
This method is the target for the Pod’s thread or 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.Note
Please note that env variables are process-specific. Subprocess inherits envs from the main process. But Subprocess’s envs do NOT affect the main process. It does NOT mess up user local system envs.
- Parameters:
args (
Namespace
) – namespace args from the Podname (
str
) – name of the Pod to have proper loggingcontainer_name (
str
) – name to set the Container tonet_mode (
Optional
[str
]) – The network mode where to run the containerruntime_ctrl_address (
str
) – The control address of the runtime in the containerenvs (
Dict
) – Dictionary of environment variables to be set in the docker imageis_started (
Union
[Event
,Event
]) – concurrency event to communicate runtime is properly started. Used for better loggingis_shutdown (
Union
[Event
,Event
]) – concurrency event to communicate runtime is terminatedis_ready (
Union
[Event
,Event
]) – concurrency event to communicate runtime is ready to receive messages
- class jina.orchestrate.pods.container.ContainerPod(args)[source]#
Bases:
BasePod
ContainerPod
starts a runtime ofBaseRuntime
inside a container. It leveragesthreading.Thread
ormultiprocessing.Process
to manage the logs and the lifecycle of docker container object in a robust way.- start()[source]#
Start the ContainerPod. This method calls
start()
inthreading.Thread
ormultiprocesssing.Process
. .. #noqa: DAR201
- join(*args, **kwargs)[source]#
Joins the Pod. This method calls
join()
inthreading.Thread
ormultiprocesssing.Process
.- Parameters:
args – extra positional arguments to pass to join
kwargs – extra keyword arguments to pass to join
- async async_wait_start_success()#
Wait for the Pod to start successfully in a non-blocking manner
- close()#
Close the Pod
This method makes sure that the Process is properly finished and its resources properly released
- Return type:
None
- property role: PodRoleType#
Get the role of this pod in a deployment .. #noqa: DAR201
- Return type:
- wait_start_success()#
Block until all pods starts successfully.
If not success, it will raise an error hoping the outer function to catch it