ray.serve.schema.ServeApplicationSchema
ray.serve.schema.ServeApplicationSchema#
- pydantic model ray.serve.schema.ServeApplicationSchema[source]#
Describes one Serve application, and currently can also be used as a standalone config to deploy a single application to a Ray cluster.
This is the request JSON schema for the v1 REST API
PUT "/api/serve/deployments/"
.Show JSON schema
{ "title": "ServeApplicationSchema", "description": "Describes one Serve application, and currently can also be used as a standalone\nconfig to deploy a single application to a Ray cluster.\n\nThis is the request JSON schema for the v1 REST API `PUT \"/api/serve/deployments/\"`.", "type": "object", "properties": { "name": { "title": "Name", "description": "Application name, the name should be unique within the serve instance", "default": "default", "type": "string" }, "route_prefix": { "title": "Route Prefix", "description": "Route prefix for HTTP requests. If not provided, it will useroute_prefix of the ingress deployment. By default, the ingress route prefix is '/'.", "default": "/", "type": "string" }, "import_path": { "title": "Import Path", "description": "An import path to a bound deployment node. Should be of the form \"module.submodule_1...submodule_n.dag_node\". This is equivalent to \"from module.submodule_1...submodule_n import dag_node\". Only works with Python applications. This field is REQUIRED when deploying Serve config to a Ray cluster.", "type": "string" }, "runtime_env": { "title": "Runtime Env", "description": "The runtime_env that the deployment graph will be run in. Per-deployment runtime_envs will inherit from this. working_dir and py_modules may contain only remote URIs.", "default": {}, "type": "object" }, "host": { "title": "Host", "description": "Host for HTTP servers to listen on. Defaults to \"0.0.0.0\", which exposes Serve publicly. Cannot be updated once your Serve application has started running. The Serve application must be shut down and restarted with the new host instead.", "default": "0.0.0.0", "type": "string" }, "port": { "title": "Port", "description": "Port for HTTP server. Defaults to 8000. Cannot be updated once your Serve application has started running. The Serve application must be shut down and restarted with the new port instead.", "default": 8000, "type": "integer" }, "deployments": { "title": "Deployments", "description": "Deployment options that override options specified in the code.", "default": [], "type": "array", "items": { "$ref": "#/definitions/DeploymentSchema" } }, "args": { "title": "Args", "description": "Arguments that will be passed to the application builder.", "default": {}, "type": "object" } }, "required": [ "import_path" ], "definitions": { "RayActorOptionsSchema": { "title": "RayActorOptionsSchema", "description": "Options with which to start a replica actor.", "type": "object", "properties": { "runtime_env": { "title": "Runtime Env", "description": "This deployment's runtime_env. working_dir and py_modules may contain only remote URIs.", "default": {}, "type": "object" }, "num_cpus": { "title": "Num Cpus", "description": "The number of CPUs required by the deployment's application per replica. This is the same as a ray actor's num_cpus. Uses a default if null.", "minimum": 0, "type": "number" }, "num_gpus": { "title": "Num Gpus", "description": "The number of GPUs required by the deployment's application per replica. This is the same as a ray actor's num_gpus. Uses a default if null.", "minimum": 0, "type": "number" }, "memory": { "title": "Memory", "description": "Restrict the heap memory usage of each replica. Uses a default if null.", "minimum": 0, "type": "number" }, "object_store_memory": { "title": "Object Store Memory", "description": "Restrict the object store memory used per replica when creating objects. Uses a default if null.", "minimum": 0, "type": "number" }, "resources": { "title": "Resources", "description": "The custom resources required by each replica.", "default": {}, "type": "object" }, "accelerator_type": { "title": "Accelerator Type", "description": "Forces replicas to run on nodes with the specified accelerator type.", "type": "string" } } }, "DeploymentSchema": { "title": "DeploymentSchema", "description": "Specifies options for one deployment within a Serve application. For each deployment\nthis can optionally be included in `ServeApplicationSchema` to override deployment\noptions specified in code.", "type": "object", "properties": { "name": { "title": "Name", "description": "Globally-unique name identifying this deployment.", "type": "string" }, "num_replicas": { "title": "Num Replicas", "description": "The number of processes that handle requests to this deployment. Uses a default if null.", "default": 1, "exclusiveMinimum": 0, "type": "integer" }, "route_prefix": { "title": "Route Prefix", "description": "[DEPRECATED] Please use route_prefix under ServeApplicationSchema instead.", "default": 1, "type": "string" }, "max_concurrent_queries": { "title": "Max Concurrent Queries", "description": "The max number of pending queries in a single replica. Uses a default if null.", "default": 1, "exclusiveMinimum": 0, "type": "integer" }, "user_config": { "title": "User Config", "description": "Config to pass into this deployment's reconfigure method. This can be updated dynamically without restarting replicas", "default": 1, "type": "object" }, "autoscaling_config": { "title": "Autoscaling Config", "description": "Config specifying autoscaling parameters for the deployment's number of replicas. If null, the deployment won't autoscale its number of replicas; the number of replicas will be fixed at num_replicas.", "default": 1, "type": "object" }, "graceful_shutdown_wait_loop_s": { "title": "Graceful Shutdown Wait Loop S", "description": "Duration that deployment replicas will wait until there is no more work to be done before shutting down. Uses a default if null.", "default": 1, "minimum": 0, "type": "number" }, "graceful_shutdown_timeout_s": { "title": "Graceful Shutdown Timeout S", "description": "Serve controller waits for this duration before forcefully killing the replica for shutdown. Uses a default if null.", "default": 1, "minimum": 0, "type": "number" }, "health_check_period_s": { "title": "Health Check Period S", "description": "Frequency at which the controller will health check replicas. Uses a default if null.", "default": 1, "exclusiveMinimum": 0, "type": "number" }, "health_check_timeout_s": { "title": "Health Check Timeout S", "description": "Timeout that the controller will wait for a response from the replica's health check before marking it unhealthy. Uses a default if null.", "default": 1, "exclusiveMinimum": 0, "type": "number" }, "ray_actor_options": { "title": "Ray Actor Options", "description": "Options set for each replica actor.", "default": 1, "allOf": [ { "$ref": "#/definitions/RayActorOptionsSchema" } ] }, "placement_group_bundles": { "title": "Placement Group Bundles", "description": "Define a set of placement group bundles to be scheduled *for each replica* of this deployment. The replica actor will be scheduled in the first bundle provided, so the resources specified in `ray_actor_options` must be a subset of the first bundle's resources. All actors and tasks created by the replica actor will be scheduled in the placement group by default (`placement_group_capture_child_tasks` is set to True).", "default": 1, "type": "array", "items": { "type": "object", "additionalProperties": { "type": "number" } } }, "placement_group_strategy": { "title": "Placement Group Strategy", "description": "Strategy to use for the replica placement group specified via `placement_group_bundles`. Defaults to `PACK`.", "default": 1, "type": "string" }, "max_replicas_per_node": { "title": "Max Replicas Per Node", "description": "[EXPERIMENTAL] The max number of deployment replicas can run on a single node. Valid values are None (no limitation) or an integer in the range of [1, 100]. Defaults to no limitation.", "default": 1, "type": "integer" } }, "required": [ "name" ] } } }
- Fields
- Validators
- field args: Dict = {}#
Arguments that will be passed to the application builder.
- field deployments: List[ray.serve.schema.DeploymentSchema] = []#
Deployment options that override options specified in the code.
- field host: str = '0.0.0.0'#
Host for HTTP servers to listen on. Defaults to “0.0.0.0”, which exposes Serve publicly. Cannot be updated once your Serve application has started running. The Serve application must be shut down and restarted with the new host instead.
- field import_path: str [Required]#
An import path to a bound deployment node. Should be of the form “module.submodule_1…submodule_n.dag_node”. This is equivalent to “from module.submodule_1…submodule_n import dag_node”. Only works with Python applications. This field is REQUIRED when deploying Serve config to a Ray cluster.
- Validated by
- field port: int = 8000#
Port for HTTP server. Defaults to 8000. Cannot be updated once your Serve application has started running. The Serve application must be shut down and restarted with the new port instead.
- field route_prefix: Optional[str] = '/'#
Route prefix for HTTP requests. If not provided, it will useroute_prefix of the ingress deployment. By default, the ingress route prefix is ‘/’.
- field runtime_env: dict = {}#
The runtime_env that the deployment graph will be run in. Per-deployment runtime_envs will inherit from this. working_dir and py_modules may contain only remote URIs.
- Validated by
- static get_empty_schema_dict() Dict [source]#
Returns an empty app schema dictionary.
Schema can be used as a representation of an empty Serve application config.
- validator import_path_format_valid » import_path[source]#
- kubernetes_dict(**kwargs) Dict [source]#
Returns dictionary in Kubernetes format.
Dictionary can be yaml-dumped to a Serve config file directly and then copy-pasted into a RayService Kubernetes config.
Args: all kwargs are passed directly into schema’s dict() function.
- validator runtime_env_contains_remote_uris » runtime_env[source]#