mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00
[serve] Use deploy_group
in serve run
and set HTTP options (#23215)
This commit is contained in:
parent
56ddea85a1
commit
d1a528d6af
1 changed files with 20 additions and 5 deletions
|
@ -1687,7 +1687,7 @@ def _get_deployments_from_node(node: DeploymentNode) -> List[Deployment]:
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
deployment_list(List[Deployment]): the list of Deployment objects. The
|
deployment_list(List[Deployment]): the list of Deployment objects. The
|
||||||
last element correspond to the node passed in to this function.
|
last element corresponds to the node passed in to this function.
|
||||||
"""
|
"""
|
||||||
from ray.serve.pipeline.api import build as pipeline_build
|
from ray.serve.pipeline.api import build as pipeline_build
|
||||||
|
|
||||||
|
@ -1712,21 +1712,36 @@ def run(
|
||||||
will be deployed.
|
will be deployed.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
client = start(detached=True, http_options={"host": host, "port": port})
|
||||||
|
|
||||||
if isinstance(target, DeploymentNode):
|
if isinstance(target, DeploymentNode):
|
||||||
deployments = _get_deployments_from_node(target)
|
deployments = _get_deployments_from_node(target)
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
for d in deployments:
|
parameter_group = [
|
||||||
logger.debug(f"Deploying {d}")
|
{
|
||||||
d.deploy()
|
"name": deployment._name,
|
||||||
|
"func_or_class": deployment._func_or_class,
|
||||||
|
"init_args": deployment.init_args,
|
||||||
|
"init_kwargs": deployment.init_kwargs,
|
||||||
|
"ray_actor_options": deployment._ray_actor_options,
|
||||||
|
"config": deployment._config,
|
||||||
|
"version": deployment._version,
|
||||||
|
"prev_version": deployment._prev_version,
|
||||||
|
"route_prefix": deployment.route_prefix,
|
||||||
|
"url": deployment.url,
|
||||||
|
}
|
||||||
|
for deployment in deployments
|
||||||
|
]
|
||||||
|
|
||||||
|
client.deploy_group(parameter_group, _blocking=True)
|
||||||
return deployments[-1].get_handle()
|
return deployments[-1].get_handle()
|
||||||
|
|
||||||
|
|
||||||
@PublicAPI(stability="alpha")
|
@PublicAPI(stability="alpha")
|
||||||
def build(target: DeploymentNode) -> Application:
|
def build(target: DeploymentNode) -> Application:
|
||||||
"""Builds a Serve application into a static configuration.
|
"""Builds a Serve application into a static application.
|
||||||
|
|
||||||
Takes in a DeploymentNode and converts it to a Serve application
|
Takes in a DeploymentNode and converts it to a Serve application
|
||||||
consisting of one or more deployments. This is intended to be used for
|
consisting of one or more deployments. This is intended to be used for
|
||||||
|
|
Loading…
Add table
Reference in a new issue