Skip to content

Conversation

@abrarsheikh
Copy link
Contributor

@abrarsheikh abrarsheikh commented Nov 1, 2025

Summary

This PR exposes deployment topology information in Ray Serve instance details, allowing users to visualize and understand the dependency graph of deployments within their applications.

What's Changed

New Data Structures

Added two new schema classes to represent deployment topology:

  • DeploymentNode - Represents a node in the deployment DAG

  • DeploymentTopology - Represents the full dependency graph

Implementation

Controller Integration

  • Updated ServeController to include deployment_topology in ApplicationDetails when serving instance details
  • Topology is now accessible via the get_serve_details() API

Example Output:

{
    "app_name": "my_app",
    "ingress_deployment": "Ingress",
    "nodes": {
        "Ingress": {
            "name": "Ingress",
            "is_ingress": True,
            "outbound_deployments": [
                {"name": "ServiceA", "app_name": "my_app"}
            ]
        },
        "ServiceA": {
            "name": "ServiceA",
            "is_ingress": False,
            "outbound_deployments": [
                {"name": "Database", "app_name": "my_app"}
            ]
        },
        "Database": {
            "name": "Database",
            "is_ingress": False,
            "outbound_deployments": []
        }
    }
}

Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: abrar <abrar@anyscale.com>
@abrarsheikh abrarsheikh changed the title Serve 1425 abrar controller 2 [3/n] [Serve] expose deployment topology in serve instance details Nov 1, 2025
Signed-off-by: abrar <abrar@anyscale.com>
@abrarsheikh abrarsheikh added the go add ONLY when ready to merge, run all tests label Nov 1, 2025
Signed-off-by: abrar <abrar@anyscale.com>
abrarsheikh added a commit that referenced this pull request Nov 14, 2025
fetch outbound deployments from all replicas at initialization.

Next PR -> #58355

---------

Signed-off-by: abrar <abrar@anyscale.com>
Base automatically changed from SERVE-1425-abrar-controller to master November 14, 2025 18:33
Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: abrar <abrar@anyscale.com>
@abrarsheikh abrarsheikh marked this pull request as ready for review November 14, 2025 20:16
@abrarsheikh abrarsheikh requested review from a team as code owners November 14, 2025 20:16
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Ingress Conflict: Silent Overwrite, Lacks Validation.

When multiple deployments have ingress=True, the code silently overwrites self._ingress_deployment_name with each one in iteration order, causing the last deployment to become the ingress. This is non-deterministic and lacks validation, unlike the similar case for multiple route prefixes which raises a RayServeException. The test change on line 230 makes this more likely by marking all deployments with a route_prefix as ingress.

python/ray/serve/_private/application_state.py#L386-L389

else:
for name, info in deployment_infos.items():
if info.ingress:
self._ingress_deployment_name = name

Fix in Cursor Fix in Web


Bug: Missing name corrupts Deployment ID.

The docs_path property creates a DeploymentID with self._ingress_deployment_name as the name without checking if it's None. When no ingress deployment exists, this passes None to DeploymentID(name=None, ...), which violates the type contract since DeploymentID.name expects a str. This will cause errors when trying to look up the deployment or use the ID.

python/ray/serve/_private/application_state.py#L279-L288

@property
def docs_path(self) -> Optional[str]:
# get the docs path from the running deployments
# we are making an assumption that the docs path can only be set
# on ingress deployments with fastapi.
ingress_deployment = DeploymentID(self._ingress_deployment_name, self._name)
return self._deployment_state_manager.get_deployment_docs_path(
ingress_deployment
)

Fix in Cursor Fix in Web


@abrarsheikh
Copy link
Contributor Author

@cursoragent its currently implicit in the code that there will always be exactly one ingress. So i odnt think we need special handling for this.

@cursor
Copy link

cursor bot commented Nov 14, 2025

Unable to authenticate your request. Please make sure to connect your GitHub account to Cursor. Go to Cursor

@ray-gardener ray-gardener bot added the serve Ray Serve Related Issue label Nov 15, 2025
ArturNiederfahrenhorst pushed a commit to ArturNiederfahrenhorst/ray that referenced this pull request Nov 16, 2025
…oject#58350)

fetch outbound deployments from all replicas at initialization.

Next PR -> ray-project#58355

---------

Signed-off-by: abrar <abrar@anyscale.com>
Aydin-ab pushed a commit to Aydin-ab/ray-aydin that referenced this pull request Nov 19, 2025
…oject#58350)

fetch outbound deployments from all replicas at initialization.

Next PR -> ray-project#58355

---------

Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: Aydin Abiar <aydin@anyscale.com>
@abrarsheikh abrarsheikh merged commit 39ae368 into master Nov 21, 2025
6 checks passed
@abrarsheikh abrarsheikh deleted the SERVE-1425-abrar-controller_2 branch November 21, 2025 19:42
400Ping pushed a commit to 400Ping/ray that referenced this pull request Nov 21, 2025
…ay-project#58355)

### Summary

This PR exposes deployment topology information in Ray Serve instance
details, allowing users to visualize and understand the dependency graph
of deployments within their applications.

### What's Changed

#### New Data Structures

Added two new schema classes to represent deployment topology:

- **`DeploymentNode`** - Represents a node in the deployment DAG

- **`DeploymentTopology`** - Represents the full dependency graph

#### Implementation

**Controller Integration**
- Updated `ServeController` to include `deployment_topology` in
`ApplicationDetails` when serving instance details
- Topology is now accessible via the `get_serve_details()` API

---

**Example Output:**

```python
{
    "app_name": "my_app",
    "ingress_deployment": "Ingress",
    "nodes": {
        "Ingress": {
            "name": "Ingress",
            "is_ingress": True,
            "outbound_deployments": [
                {"name": "ServiceA", "app_name": "my_app"}
            ]
        },
        "ServiceA": {
            "name": "ServiceA",
            "is_ingress": False,
            "outbound_deployments": [
                {"name": "Database", "app_name": "my_app"}
            ]
        },
        "Database": {
            "name": "Database",
            "is_ingress": False,
            "outbound_deployments": []
        }
    }
}
```

---------

Signed-off-by: abrar <abrar@anyscale.com>
Co-authored-by: Lonnie Liu <95255098+aslonnie@users.noreply.github.com>
ykdojo pushed a commit to ykdojo/ray that referenced this pull request Nov 27, 2025
…oject#58350)

fetch outbound deployments from all replicas at initialization.

Next PR -> ray-project#58355

---------

Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: YK <1811651+ykdojo@users.noreply.github.com>
ykdojo pushed a commit to ykdojo/ray that referenced this pull request Nov 27, 2025
…ay-project#58355)

### Summary

This PR exposes deployment topology information in Ray Serve instance
details, allowing users to visualize and understand the dependency graph
of deployments within their applications.

### What's Changed

#### New Data Structures

Added two new schema classes to represent deployment topology:

- **`DeploymentNode`** - Represents a node in the deployment DAG

- **`DeploymentTopology`** - Represents the full dependency graph

#### Implementation

**Controller Integration**
- Updated `ServeController` to include `deployment_topology` in
`ApplicationDetails` when serving instance details
- Topology is now accessible via the `get_serve_details()` API

---

**Example Output:**

```python
{
    "app_name": "my_app",
    "ingress_deployment": "Ingress",
    "nodes": {
        "Ingress": {
            "name": "Ingress",
            "is_ingress": True,
            "outbound_deployments": [
                {"name": "ServiceA", "app_name": "my_app"}
            ]
        },
        "ServiceA": {
            "name": "ServiceA",
            "is_ingress": False,
            "outbound_deployments": [
                {"name": "Database", "app_name": "my_app"}
            ]
        },
        "Database": {
            "name": "Database",
            "is_ingress": False,
            "outbound_deployments": []
        }
    }
}
```

---------

Signed-off-by: abrar <abrar@anyscale.com>
Co-authored-by: Lonnie Liu <95255098+aslonnie@users.noreply.github.com>
Signed-off-by: YK <1811651+ykdojo@users.noreply.github.com>
SheldonTsen pushed a commit to SheldonTsen/ray that referenced this pull request Dec 1, 2025
…oject#58350)

fetch outbound deployments from all replicas at initialization.

Next PR -> ray-project#58355

---------

Signed-off-by: abrar <abrar@anyscale.com>
SheldonTsen pushed a commit to SheldonTsen/ray that referenced this pull request Dec 1, 2025
…ay-project#58355)

### Summary

This PR exposes deployment topology information in Ray Serve instance
details, allowing users to visualize and understand the dependency graph
of deployments within their applications.

### What's Changed

#### New Data Structures

Added two new schema classes to represent deployment topology:

- **`DeploymentNode`** - Represents a node in the deployment DAG

- **`DeploymentTopology`** - Represents the full dependency graph

#### Implementation

**Controller Integration**
- Updated `ServeController` to include `deployment_topology` in
`ApplicationDetails` when serving instance details
- Topology is now accessible via the `get_serve_details()` API

---

**Example Output:**

```python
{
    "app_name": "my_app",
    "ingress_deployment": "Ingress",
    "nodes": {
        "Ingress": {
            "name": "Ingress",
            "is_ingress": True,
            "outbound_deployments": [
                {"name": "ServiceA", "app_name": "my_app"}
            ]
        },
        "ServiceA": {
            "name": "ServiceA",
            "is_ingress": False,
            "outbound_deployments": [
                {"name": "Database", "app_name": "my_app"}
            ]
        },
        "Database": {
            "name": "Database",
            "is_ingress": False,
            "outbound_deployments": []
        }
    }
}
```

---------

Signed-off-by: abrar <abrar@anyscale.com>
Co-authored-by: Lonnie Liu <95255098+aslonnie@users.noreply.github.com>
Future-Outlier pushed a commit to Future-Outlier/ray that referenced this pull request Dec 7, 2025
…oject#58350)

fetch outbound deployments from all replicas at initialization.

Next PR -> ray-project#58355

---------

Signed-off-by: abrar <abrar@anyscale.com>
Signed-off-by: Future-Outlier <eric901201@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go add ONLY when ready to merge, run all tests serve Ray Serve Related Issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants