ray.serve.run#

ray.serve.run(target: Application, blocking: bool = False, name: str = 'default', route_prefix: str = DEFAULT.VALUE, logging_config: Dict | LoggingConfig | None = None) DeploymentHandle[source]#

Run an application and return a handle to its ingress deployment.

The application is returned by Deployment.bind(). Example:

handle = serve.run(MyDeployment.bind())
ray.get(handle.remote())
Parameters:
  • target – A Serve application returned by Deployment.bind().

  • blocking – Whether this call should be blocking. If True, it will loop and log status until Ctrl-C’d.

  • 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. If specified neither as an argument nor in the ingress deployment, the route prefix will default to ‘/’.

  • logging_config – Application logging config. If provided, the config will be applied to all deployments which doesn’t have logging config.

Returns:

A handle that can be used to call the application.

Return type:

DeploymentHandle