jina.orchestrate.deployments package#
Subpackages#
Module contents#
- class jina.orchestrate.deployments.BaseDeployment[source]#
Bases:
ExitStack
A BaseDeployment is an immutable set of pods. Internally, the pods can run with the process/thread backend. They can be also run in their own containers on remote machines.
- abstract start()[source]#
Start to run all
Pod
in this BaseDeployment.Note
If one of the
Pod
fails to start, make sure that all of them are properly closed.- Return type
- abstract async rolling_update(*args, **kwargs)[source]#
Roll update the Executors managed by the Deployment
- property role: DeploymentRoleType#
Return the role of this
BaseDeployment
.- Return type
- property name: str#
The name of this
BaseDeployment
.- Return type
str
- property head_host: str#
Get the host of the HeadPod of this deployment .. # noqa: DAR201
- Return type
str
- property head_port#
Get the port of the HeadPod of this deployment .. # noqa: DAR201
- abstract property head_args: Namespace#
Get the arguments for the head of this BaseDeployment.
- Return type
Namespace
- property deployments: List[Dict]#
Get deployments of the deployment. The BaseDeployment just gives one deployment.
- Return type
List
[Dict
]- Returns
list of deployments
- class jina.orchestrate.deployments.Deployment(args, needs=None)[source]#
Bases:
BaseDeployment
A Deployment is an immutable set of pods, which run in replicas. They share the same input and output socket. Internally, the pods can run with the process/thread backend. They can be also run in their own containers :type args:
Union
[Namespace
,Dict
] :param args: arguments parsed from the CLI :type needs:Optional
[Set
[str
]] :param needs: deployments names of preceding deployments, the output of these deployments are going into the input of this deployment- needs#
used in the
jina.flow.Flow
to build the graph
- update_pod_args()[source]#
Update args of all its pods based on Deployment args. Including head/tail
- update_worker_pod_args()[source]#
Update args of all its worker pods based on Deployment args. Does not touch head and tail
- property is_sandbox: bool#
Check if this deployment is a sandbox.
- Return type
bool
- Returns
True if this deployment is provided as a sandbox, False otherwise
- property external: bool#
Check if this deployment is external.
- Return type
bool
- Returns
True if this deployment is provided as an external deployment, False otherwise
- property protocol#
- Returns
the protocol of this deployment, https or http
- property first_pod_args: Namespace#
Return the first worker pod’s args
- Return type
Namespace
- property host: str#
Get the host name of this deployment
- Return type
str
- property port#
- Returns
the port of this deployment
- property head_args: Namespace#
Get the arguments for the head of this Deployment.
- Return type
Namespace
- property uses_before_args: Namespace#
Get the arguments for the uses_before of this Deployment.
- Return type
Namespace
- property uses_after_args: Namespace#
Get the arguments for the uses_after of this Deployment.
- Return type
Namespace
- property all_args: List[Namespace]#
Get all arguments of all Pods in this BaseDeployment.
- Return type
List
[Namespace
]
- property num_pods: int#
Get the number of running
Pod
- Return type
int
- static get_worker_host(pod_args, pod, head_pod)[source]#
Check if the current pod and head are both containerized on the same host If so __docker_host__ needs to be advertised as the worker’s address to the head
- Parameters
pod_args – arguments of the worker pod
pod – the worker pod
head_pod – head pod communicating with the worker pod
- Returns
host to use in activate messages
- start()[source]#
Start to run all
Pod
in this BaseDeployment.- Return type
- Returns
started deployment
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 starts successfully.
If not successful, it will raise an error hoping the outer function to catch it
- Return type
None
- property is_ready: bool#
Checks if Deployment is ready
Note
A Deployment is ready when all the Pods it contains are ready
- Return type
bool