[Serve][2/n] Build/deploy flow for deployment-scoped actors#61648
Conversation
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>
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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.
| if isinstance(cls_path, str): | |
| if isinstance(name, str) and isinstance(cls_path, str): |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
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) | ||
| ] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
in the context of this code block, deployment.deployment_actors will be dict
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>


Adds plumbing for
deployment_actorsthrough 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 taskdeployment_to_serialized_deployment_actors: merges serialized actor classes from code and configoverride_deployment_info(): injects_serialized_actor_classinto deployment actor configsbuild_serve_application(): serializes code-defined actors and config-only actors, passesserialized_deployment_actorsintoget_deploy_argsDeploy utils
get_deploy_args(): addsserialized_deployment_actorsargumentget_app_code_version(): usesdeployment.deployment_actorsfrom the schema and simplifies normalizationDeployment
Deployment.options(deployment_actors=...)supportrelated #61464