ray.serve.run
ray.serve.run#
- ray.serve.run(target: Union[ray.dag.class_node.ClassNode, ray.dag.function_node.FunctionNode], _blocking: bool = True, host: str = '127.0.0.1', port: int = 8000, name: str = '', route_prefix: str = '/') Optional[ray.serve.handle.RayServeHandle] [source]#
Run a Serve application and return a ServeHandle to the ingress.
Either a ClassNode, FunctionNode, or a pre-built application can be passed in. If a node is passed in, all of the deployments it depends on will be deployed. If there is an ingress, its handle will be returned.
- Parameters
target (Union[ClassNode, FunctionNode, Application]) – A user-built Serve Application or a ClassNode that acts as the root node of DAG. By default ClassNode is the Driver deployment unless user provides a customized one.
host – Host for HTTP servers to listen on. Defaults to “127.0.0.1”. To expose Serve publicly, you probably want to set this to “0.0.0.0”.
port – Port for HTTP server. Defaults to 8000.
name – Application name. If not provided, this will be the only application running on the cluster (it will delete all others).
route_prefix – Route prefix for HTTP requests. If not provided, it will use route_prefix of the ingress deployment. By default, the ingress route prefix is ‘/’.
- Returns
- A regular ray serve handle that can be called by user
to execute the serve DAG.
- Return type
PublicAPI (beta): This API is in beta and may change before becoming stable.