Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Ray project Ray Serve Deployment Bind

From Leeroopedia
Knowledge Sources
Domains Model_Serving, Configuration_Management
Last Updated 2026-02-13 17:00 GMT

Overview

Concrete tool for configuring and binding Ray Serve deployments into deployable Application nodes provided by the Ray Java Serve SDK.

Description

Serve.deployment() returns a DeploymentCreator builder. Configuration methods set deployment properties. .bind(args...) calls .create() to build a Deployment object, then Deployment.bind(args) constructs a ClassNode DAG node wrapped as an Application.

Usage

Chain configuration methods on the DeploymentCreator and call .bind() to produce an Application for deployment.

Code Reference

Source Location

  • Repository: ray-project/ray
  • File: java/serve/src/main/java/io/ray/serve/api/Serve.java (L150, deployment factory)
  • File: java/serve/src/main/java/io/ray/serve/deployment/DeploymentCreator.java (L75-118)
  • File: java/serve/src/main/java/io/ray/serve/deployment/Deployment.java (L99-110)

Signature

// Factory
public static DeploymentCreator deployment()

// Builder methods (on DeploymentCreator)
public DeploymentCreator setName(String name)
public DeploymentCreator setNumReplicas(Integer numReplicas)
public DeploymentCreator setDeploymentDef(String deploymentDef)
public DeploymentCreator setMaxOngoingRequests(Integer maxOngoingRequests)
public DeploymentCreator setAutoscalingConfig(AutoscalingConfig config)
public DeploymentCreator setRoutePrefix(String routePrefix)
public DeploymentCreator setUserConfig(Object userConfig)

// Bind
public Application bind(Object... args)

Import

import io.ray.serve.api.Serve;
import io.ray.serve.deployment.Application;

I/O Contract

Inputs

Name Type Required Description
name String Yes Deployment name
deploymentDef String Yes Fully-qualified class name of the deployment handler
numReplicas Integer No Number of replicas (default: 1)
args Object... No Constructor arguments for the deployment class
autoscalingConfig AutoscalingConfig No Autoscaling configuration

Outputs

Name Type Description
application Application A DAG node wrapper ready for Serve.run()

Usage Examples

Configure and Bind a Deployment

import io.ray.serve.api.Serve;
import io.ray.serve.deployment.Application;

Application app = Serve.deployment()
    .setName("my-model")
    .setDeploymentDef("com.example.ModelServer")
    .setNumReplicas(4)
    .setRoutePrefix("/predict")
    .bind();

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment