ray.serve.run#

ray.serve.run(target: ray.serve.deployment.Application, _blocking: bool = True, host: str = '127.0.0.1', 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())
ray.get(handle.remote())
Parameters
  • 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 “127.0.0.1”. To expose Serve publicly, you probably want to set this to “0.0.0.0”.

  • 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 ‘/’.

Returns

A handle that can be used to call the application.

Return type

RayServeSyncHandle