ray.serve.run(target: ray.serve.deployment.Application, _blocking: bool = True, host: str = '', port: int = 8000, name: str = 'default', route_prefix: str = DEFAULT.VALUE) Optional[ray.serve.handle.RayServeSyncHandle][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())
  • target – A Serve application returned by Deployment.bind().

  • host – [DEPRECATED: use serve.start to set HTTP options] Host for HTTP servers to listen on. Defaults to “”. To expose Serve publicly, you probably want to set this to “”.

  • port – [DEPRECATED: use serve.start to set HTTP options] 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. If specified neither as an argument nor in the ingress deployment, the route prefix will default to ‘/’.


A handle that can be used to call the application.

Return type