Skip to content

[Serve][2/n] Build/deploy flow for deployment-scoped actors#61648

Merged
abrarsheikh merged 11 commits into
masterfrom
pr-2a-build-deploy
Mar 11, 2026
Merged

[Serve][2/n] Build/deploy flow for deployment-scoped actors#61648
abrarsheikh merged 11 commits into
masterfrom
pr-2a-build-deploy

Conversation

@abrarsheikh

@abrarsheikh abrarsheikh commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

Adds plumbing for deployment_actors through the build and deploy pipeline. Deployment configs flow end-to-end, but deployment actors are not started yet (that’s in pr-2a-activation).

Changes

Application state

  • deployment_to_deployment_actor_classes: extracts config-only actor class paths from the app config for the build task
  • deployment_to_serialized_deployment_actors: merges serialized actor classes from code and config
  • override_deployment_info(): injects _serialized_actor_class into deployment actor configs
  • build_serve_application(): serializes code-defined actors and config-only actors, passes serialized_deployment_actors into get_deploy_args

Deploy utils

  • get_deploy_args(): adds serialized_deployment_actors argument
  • get_app_code_version(): uses deployment.deployment_actors from the schema and simplifies normalization

Deployment

  • Deployment.options(deployment_actors=...) support

related #61464

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>
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 base branch from master to pr-1-config-schema March 11, 2026 05:43

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds the necessary plumbing for deployment-scoped actors, a significant new feature. The changes are well-structured across the application state, configuration, and utility modules. The new DeploymentActorConfig class is particularly well-designed, with robust serialization logic. I have one suggestion to improve the robustness of handling user-provided configurations.

Note: Security Review did not run due to the size of the PR.

if isinstance(actor_cfg, dict):
name = actor_cfg.get("name")
cls_path = actor_cfg.get("actor_class")
if isinstance(cls_path, str):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

It's good to check that cls_path is a string. It would be more robust to also check that name is a valid string here, as actor_cfg.get("name") could return None if the key is missing in the user-provided config. Using None as a dictionary key is likely not intended and could lead to issues downstream.

Suggested change
if isinstance(cls_path, str):
if isinstance(name, str) and isinstance(cls_path, str):
Base automatically changed from pr-1-config-schema to master March 11, 2026 16:28
@abrarsheikh abrarsheikh marked this pull request as ready for review March 11, 2026 16:37
@abrarsheikh abrarsheikh requested a review from a team as a code owner March 11, 2026 16:37

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

deployment.deployment_actors
for deployment in app_config.deployments
if isinstance(deployment.deployment_actors, list)
]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

json.dumps fails on non-dict DeploymentActorConfig objects

Low Severity

The simplified get_app_code_version now passes deployment.deployment_actors directly into json.dumps without normalization. The schema's deployment_actors field accepts Union[Dict, DeploymentActorConfig], but DeploymentActorConfig (a Pydantic BaseModel) is not natively JSON-serializable. The old code explicitly handled this by calling model_dump() and normalizing actor_class to a string representation. If a DeploymentActorConfig instance ends up in the list, json.dumps raises a TypeError.

Fix in Cursor Fix in Web

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

in the context of this code block, deployment.deployment_actors will be dict

@abrarsheikh abrarsheikh added the go add ONLY when ready to merge, run all tests label Mar 11, 2026
@ray-gardener ray-gardener Bot added the serve Ray Serve Related Issue label Mar 11, 2026
@abrarsheikh abrarsheikh merged commit 680b386 into master Mar 11, 2026
6 of 7 checks passed
@abrarsheikh abrarsheikh deleted the pr-2a-build-deploy branch March 11, 2026 21:09
abrarsheikh added a commit that referenced this pull request Mar 11, 2026
Adds plumbing for `deployment_actors` through the build and deploy
pipeline. Deployment configs flow end-to-end, but deployment actors are
not started yet (that’s in pr-2a-activation).

### Changes

**Application state**
- `deployment_to_deployment_actor_classes`: extracts config-only actor
class paths from the app config for the build task
- `deployment_to_serialized_deployment_actors`: merges serialized actor
classes from code and config
- `override_deployment_info()`: injects `_serialized_actor_class` into
deployment actor configs
- `build_serve_application()`: serializes code-defined actors and
config-only actors, passes `serialized_deployment_actors` into
`get_deploy_args`

**Deploy utils**
- `get_deploy_args()`: adds `serialized_deployment_actors` argument
- `get_app_code_version()`: uses `deployment.deployment_actors` from the
schema and simplifies normalization

**Deployment**
- `Deployment.options(deployment_actors=...)` support

---------

Signed-off-by: abrar <abrar@anyscale.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

2 participants