ray.serve.run#

ray.serve.run(target: Application, blocking: bool = False, name: str = 'default', route_prefix: str | None = '/', logging_config: Dict | LoggingConfig | None = None, _local_testing_mode: bool = False) 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. Defaults to ‘/’. If None is passed, the application will not be exposed over HTTP (this may be useful if you only want the application to be exposed via gRPC or a DeploymentHandle).

  • 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