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:

BaseDeployment

property role: DeploymentRoleType#

Return the role of this BaseDeployment.

Return type:

DeploymentRoleType

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

property head_port_monitoring#

Get the port_monitoring 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

abstract join()[source]#

Wait until all deployment and pods exit.

property deployments: List[Dict]#

Get deployments of the deployment. The BaseDeployment just gives one deployment.

Return type:

List[Dict]

Returns:

list of deployments

callback(**kwds)#

Registers an arbitrary callback and arguments.

Cannot suppress exceptions.

close()#

Immediately unwind the context stack.

enter_context(cm)#

Enters the supplied context manager.

If successful, also pushes its __exit__ method as a callback and returns the result of the __enter__ method.

pop_all()#

Preserve the context stack by transferring it to a new instance.

push(exit)#

Registers a callback with the standard __exit__ method signature.

Can suppress exceptions the same way __exit__ method can. Also accepts any object with an __exit__ method (registering a call to the method instead of the object itself).

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_sandbox_args()[source]#

Update args of all its pods based on the host and port returned by Hubble

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 tls_enabled#

Checks whether secure connection via tls is enabled for this Deployment.

Returns:

True if tls is enabled, 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

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 ports: List[int]#

Returns a list of ports exposed by this Deployment. Exposed means these are the ports a Client/Gateway is supposed to communicate with. For sharded deployments this will be the head_port. For non sharded deployments it will be all replica ports .. # noqa: DAR201

Return type:

List[int]

property dockerized_uses: bool#

Checks if this Deployment uses a dockerized Executor

Return type:

bool

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_is_container, head_is_container)[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_is_container – boolean specifying if pod is to be run in container

  • head_is_container – boolean specifying if head pod is to be run in container

Returns:

host to pass in connection list of the head

start()[source]#

Start to run all Pod in this BaseDeployment.

Return type:

Deployment

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

join()[source]#

Wait until all pods exit

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

callback(**kwds)#

Registers an arbitrary callback and arguments.

Cannot suppress exceptions.

close()#

Immediately unwind the context stack.

property deployments: List[Dict]#

Get deployments of the deployment. The BaseDeployment just gives one deployment.

Return type:

List[Dict]

Returns:

list of deployments

enter_context(cm)#

Enters the supplied context manager.

If successful, also pushes its __exit__ method as a callback and returns the result of the __enter__ method.

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

property head_port_monitoring#

Get the port_monitoring of the HeadPod of this deployment .. # noqa: DAR201

property name: str#

The name of this BaseDeployment.

Return type:

str

pop_all()#

Preserve the context stack by transferring it to a new instance.

push(exit)#

Registers a callback with the standard __exit__ method signature.

Can suppress exceptions the same way __exit__ method can. Also accepts any object with an __exit__ method (registering a call to the method instead of the object itself).

property role: DeploymentRoleType#

Return the role of this BaseDeployment.

Return type:

DeploymentRoleType