Service API Reference (Legacy)
Service API Reference (Legacy)
These APIs are legacy and deprecated. Please use the current APIs instead.
Service CLI
anyscale service rollout
Deprecated
anyscale service rollout
has been deprecated. and will be removed on 2025-10-01. Please use anyscale service deploy
instead.
Usage
anyscale service rollout [OPTIONS]
[DEPRECATED - use 'deploy' instead] Roll out a service.
Options
-f/--config-file/--service-config-file
: The path of the service configuration file.--name/-n
: Name of service.--version
: Version of service.--max-surge-percent
: Max amount of excess capacity allocated during the rollout (0-100).--canary-percent
: The percentage of traffic to send to the canary version of the service.--rollout-strategy
: Strategy for rollout.-i/--in-place
: Alias for--rollout-strategy=IN_PLACE
.--no-auto-complete-rollout
: Do not complete the rollout (terminate the existing version cluster) after the canary version reaches 100%
Service SDK
The AnyscaleSDK class must be constructed in order to make calls to the SDK. This class allows you to create an authenticated client in which to use the SDK.
Param | Type | Description |
---|---|---|
auth_token | Optional String | Authentication token used to verify you have permissions to access Anyscale. If not provided, permissions default to the credentials set for your current user. Credentials can be set by following the instructions on this page: https://console.anyscale.com/credentials |
Example
from anyscale import AnyscaleSDK
sdk = AnyscaleSDK()
get_service
Get a Service
Parameters
Name | Type | Description | Notes |
---|---|---|---|
service_id | str | Defaults to null |
Returns ServicemodelResponse
rollback_service
Rollback a Service
Parameters
Name | Type | Description | Notes |
---|---|---|---|
service_id | str | Defaults to null | |
rollback_service_model | RollbackServiceModel |
Returns ServicemodelResponse
rollout_service
Rollout a service
Parameters
Name | Type | Description | Notes |
---|---|---|---|
apply_service_model | ApplyServiceModel |
Returns ServicemodelResponse
terminate_service
Terminate a Service
Parameters
Name | Type | Description | Notes |
---|---|---|---|
service_id | str | Defaults to null |
Returns ServicemodelResponse
list_services
Parameters
Name | Type | Description | Notes |
---|---|---|---|
project_id | optional str | project_id to filter by | Defaults to null |
name | optional str | name to filter by | Defaults to null |
state_filter | List[ServiceEventCurrentState] | A list of Service states to filter by | Defaults to [] |
archive_status | ArchiveStatus | The archive status to filter by. Defaults to unarchived. | Defaults to null |
creator_id | optional str | creator_id to filter by | Defaults to null |
cloud_id | optional str | cloud_id to filter by | Defaults to null |
sort_field | ServiceSortField | If absent, the default sorting order is 1. status (active first).2. Last updated at (desc). 3. Name (asc). | Defaults to null |
sort_order | SortOrder | If sort_field is absent, this field is ignored.If absent, this field defaults to ascending. | Defaults to null |
paging_token | optional str | Defaults to null | |
count | optional int | Defaults to null |
Returns ServicemodelListResponse
Service Models
ApplyProductionServiceV2Model
DEPRECATED. Please do not use this model directly. Use ApplyServiceModel.
Name | Type | Description | Notes |
---|---|---|---|
name | str | Name of the Service | [default to null] |
description | str | Description of the Service | [optional] [default to null] |
project_id | str | Id of the project this Service will start clusters in | [optional] [default to null] |
version | str | A version string that represents the version for this service. Will be populated with the hash of the config if not specified. | [optional] [default to null] |
canary_percent | int | A manual target percent for this service. If this field is not set, the service will automatically roll out. If set, this should be a number between 0 and 100. The newly created version will have weight `canary_percent` and the existing version will have `100 - canary_percent`. | [optional] [default to null] |
ray_serve_config | object | The Ray Serve config to use for this service. This config defines your Ray Serve application, and will be passed directly to Ray Serve. You can learn more about Ray Serve config files here: https://docs.ray.io/en/latest/serve/production-guide/config.html | [default to null] |
build_id | str | The id of the cluster env build. This id will determine the docker image your Service is run using. | [default to null] |
compute_config_id | str | The id of the compute configuration that you want to use. This id will specify the resources required for your ServiceThe compute template includes a `cloud_id` that must be fixed for each service. | [default to null] |
config | ServiceConfig | Target Service's configuration | [optional] [default to null] |
rollout_strategy | RolloutStrategy | Strategy for rollout. The ROLLOUT strategy will deploy your Ray Serve configuration onto a newly started cluster, and then shift traffic over to the new cluster. You can manually control the speed of the rollout using the canary_percent configuration. The IN_PLACE strategy will use Ray Serve in place upgrade to update your existing cluster in place. When using this rollout strategy, you may only change the ray_serve_config field. You cannot partially shift traffic or rollback an in place upgrade. In place upgrades are faster and riskier than rollouts, and we recommend only using them for relatively safe changes (for example, increasing the number of replicas on a Ray Serve deployment). Default strategy is ROLLOUT. | [optional] [default to null] |
ray_gcs_external_storage_config | RayGCSExternalStorageConfig | Config for the Ray GCS to connect to external storage. If populated, head node fault tolerance will be enabled for this service. | [optional] [default to null] |
tracing_config | TracingConfig | Config for initializing tracing within Anyscale runtime. | [optional] [default to null] |
auto_complete_rollout | bool | Flag to indicate whether or not to complete the rollout after the canary version reaches 100%. | [optional] [default to true] |
max_surge_percent | int | Max amount of excess capacity allocated during the rollout (0-100). | [optional] [default to null] |
ApplyServiceModel
This is the model used to apply a Service.
Name | Type | Description | Notes |
---|---|---|---|
name | str | Name of the Service | [default to null] |
description | str | Description of the Service | [optional] [default to null] |
project_id | str | Id of the project this Service will start clusters in | [optional] [default to null] |
version | str | A version string that represents the version for this service. Will be populated with the hash of the config if not specified. | [optional] [default to null] |
canary_percent | int | A manual target percent for this service. If this field is not set, the service will automatically roll out. If set, this should be a number between 0 and 100. The newly created version will have weight `canary_percent` and the existing version will have `100 - canary_percent`. | [optional] [default to null] |
ray_serve_config | object | The Ray Serve config to use for this service. This config defines your Ray Serve application, and will be passed directly to Ray Serve. You can learn more about Ray Serve config files here: https://docs.ray.io/en/latest/serve/production-guide/config.html | [default to null] |
build_id | str | The id of the cluster env build. This id will determine the docker image your Service is run using. | [default to null] |
compute_config_id | str | The id of the compute configuration that you want to use. This id will specify the resources required for your ServiceThe compute template includes a `cloud_id` that must be fixed for each service. | [default to null] |
config | ServiceConfig | Target Service's configuration | [optional] [default to null] |
rollout_strategy | RolloutStrategy | Strategy for rollout. The ROLLOUT strategy will deploy your Ray Serve configuration onto a newly started cluster, and then shift traffic over to the new cluster. You can manually control the speed of the rollout using the canary_percent configuration. The IN_PLACE strategy will use Ray Serve in place upgrade to update your existing cluster in place. When using this rollout strategy, you may only change the ray_serve_config field. You cannot partially shift traffic or rollback an in place upgrade. In place upgrades are faster and riskier than rollouts, and we recommend only using them for relatively safe changes (for example, increasing the number of replicas on a Ray Serve deployment). Default strategy is ROLLOUT. | [optional] [default to null] |
ray_gcs_external_storage_config | RayGCSExternalStorageConfig | Config for the Ray GCS to connect to external storage. If populated, head node fault tolerance will be enabled for this service. | [optional] [default to null] |
tracing_config | TracingConfig | Config for initializing tracing within Anyscale runtime. | [optional] [default to null] |
auto_complete_rollout | bool | Flag to indicate whether or not to complete the rollout after the canary version reaches 100%. | [optional] [default to true] |
max_surge_percent | int | Max amount of excess capacity allocated during the rollout (0-100). | [optional] [default to null] |
ListServiceModel
The list model for Services. Please note that this model can be used for both Service v1 and v2. You can use the type
field to differentiate between the two.
Name | Type | Description | Notes |
---|---|---|---|
id | str | [default to null] | |
name | str | [default to null] | |
creator_id | str | Id of the user who created the Service | [default to null] |
created_at | datetime | Time the Service was created | [default to null] |
project_id | str | Id of the project this Service will start clusters in. This configuration cannot be changed after the service is created. | [default to null] |
current_state | ServiceEventCurrentState | The current state of this service | [default to null] |
endtime | datetime | [optional] [default to null] | |
type | ServiceType | Type of the Service | [optional] [default to null] |
service_observability_urls | ServiceObservabilityUrls | A JSON object with useful urls pointing to Grafana dashboards. | [default to null] |
ListservicemodelListResponse
A list response form the API. Contains a field "results" which has the contents of the response.
Name | Type | Description | Notes |
---|---|---|---|
results | List[ListServiceModel] | [default to null] | |
metadata | ListResponseMetadata | [optional] [default to null] |
ProductionServiceV2Model
DEPRECATED. Please use ServiceModel with new sdk calls.
Name | Type | Description | Notes |
---|---|---|---|
id | str | Id of the Service | [default to null] |
name | str | Name of the Service | [default to null] |
description | str | Description of the Service | [optional] [default to null] |
project_id | str | Id of the project this Service will start clusters in. This configuration cannot be changed after the service is created. | [default to null] |
cloud_id | str | Id of the cloud this Service belongs to, and will launch clusters in. This configuration cannot be changed. | [default to null] |
creator_id | str | Id of the user who created the Service | [default to null] |
created_at | datetime | Time the Service was created | [default to null] |
hostname | str | The hostname of the service | [default to null] |
current_state | ServiceEventCurrentState | The current state of this service | [default to null] |
goal_state | ServiceGoalStates | The goal state of this service | [default to null] |
auth_token | str | Token to use for service auth. To use the token, add it as a header with the key 'Authorization' and the value 'Bearer <token>' | [optional] [default to null] |
auto_rollout_enabled | bool | Whether or not the service is using auto rollout | [default to null] |
versions | List[ProductionServiceV2VersionModel] | DEPRECATED. Please use `primary_version` and `canary_version` fields. Active versions of this service, sorted by creation time in ascending order. | [default to null] |
primary_version | ProductionServiceV2VersionModel | Primary version of this service. If the service is terminated, this field refers to the most recently active version. | [default to null] |
canary_version | ProductionServiceV2VersionModel | Canary version of this service. Present only if the service is in the `ROLLING_OUT` state. | [optional] [default to null] |
service_observability_urls | ServiceObservabilityUrls | A JSON object with useful urls pointing to Grafana dashboards. | [default to null] |
base_url | str | The base url of this service | [default to null] |
ended_at | datetime | Time the Service was terminated | [optional] [default to null] |
ProductionServiceV2VersionModel
Name | Type | Description | Notes |
---|---|---|---|
id | str | Id of the Service Version | [default to null] |
created_at | datetime | Time the version was created | [default to null] |
weight | int | The target percentage of traffic sent to this version. This is a number between 0 and 100. | [default to null] |
current_weight | int | The current percentage of traffic sent to this version. This is a number between 0 and 100. | [optional] [default to null] |
version | str | The version string identifier for this version | [default to null] |
ray_serve_config | object | [default to null] | |
ray_gcs_external_storage_config | RayGCSExternalStorageConfig | Config for the Ray GCS to connect to external storage. If populated, head node fault tolerance is enabled for this service. | [optional] [default to null] |
tracing_config | TracingConfig | Config for initializing tracing within Anyscale runtime. | [optional] [default to null] |
build_id | str | The id of the cluster env build. This id will determine the docker image your Service is run using. | [default to null] |
compute_config_id | str | The id of the compute configuration that you want to use. This id will specify the resources required for your Service.The compute template includes a `cloud_id` that cannot be updated. | [default to null] |
production_job_ids | List[str] | The list of production job ids associated with this service version. | [default to null] |
current_state | ServiceVersionState | The current state of the service version. | [default to null] |
Productionservicev2ModelResponse
A response from the API. Contains a field "result" which has the contents of the response.
Name | Type | Description | Notes |
---|---|---|---|
result | ProductionServiceV2Model | [default to null] |
RollbackServiceModel
The rollback model for Services.
Name | Type | Description | Notes |
---|---|---|---|
max_surge_percent | int | The max_surge_percent to use when rolling back. | [optional] [default to null] |
RolloutStrategy
An enumeration.
Possible Values: ['ROLLOUT', 'IN_PLACE']
ServiceConfig
Name | Type | Description | Notes |
---|---|---|---|
max_uptime_timeout_sec | int | Auto-termination timeout (in seconds) for target Service to be unconditionally terminated after specified period. Setting this to 0 disables auto-termination (default). | [optional] [default to 0] |
access | AccessConfig | Access configuration | [optional] [default to null] |
protocols | Protocols | Protocol setups for the service | [optional] [default to null] |
env_vars | object | Environment variables to set on the service cluster | [optional] [default to null] |
ServiceEventCurrentState
The possible 'current state' values for a service These states may be shown in the UI as the primary state of the service
Possible Values: ['RUNNING', 'UNHEALTHY', 'SYSTEM_FAILURE', 'USER_ERROR_FAILURE', 'STARTING', 'TERMINATING', 'TERMINATED', 'UPDATING', 'ROLLING_OUT', 'ROLLING_BACK']
ServiceGoalStates
An enumeration.
Possible Values: ['RUNNING', 'TERMINATED']
ServiceModel
This is the Service model returned by the get path.
Name | Type | Description | Notes |
---|---|---|---|
id | str | Id of the Service | [default to null] |
name | str | Name of the Service | [default to null] |
description | str | Description of the Service | [optional] [default to null] |
project_id | str | Id of the project this Service will start clusters in. This configuration cannot be changed after the service is created. | [default to null] |
cloud_id | str | Id of the cloud this Service belongs to, and will launch clusters in. This configuration cannot be changed. | [default to null] |
creator_id | str | Id of the user who created the Service | [default to null] |
created_at | datetime | Time the Service was created | [default to null] |
hostname | str | The hostname of the service | [default to null] |
current_state | ServiceEventCurrentState | The current state of this service | [default to null] |
goal_state | ServiceGoalStates | The goal state of this service | [default to null] |
auth_token | str | Token to use for service auth. To use the token, add it as a header with the key 'Authorization' and the value 'Bearer <token>' | [optional] [default to null] |
auto_rollout_enabled | bool | Whether or not the service is using auto rollout | [default to null] |
versions | List[ProductionServiceV2VersionModel] | DEPRECATED. Please use `primary_version` and `canary_version` fields. Active versions of this service, sorted by creation time in ascending order. | [default to null] |
primary_version | ProductionServiceV2VersionModel | Primary version of this service. If the service is terminated, this field refers to the most recently active version. | [default to null] |
canary_version | ProductionServiceV2VersionModel | Canary version of this service. Present only if the service is in the `ROLLING_OUT` state. | [optional] [default to null] |
service_observability_urls | ServiceObservabilityUrls | A JSON object with useful urls pointing to Grafana dashboards. | [default to null] |
base_url | str | The base url of this service | [default to null] |
ended_at | datetime | Time the Service was terminated | [optional] [default to null] |
ServiceObservabilityUrls
Name | Type | Description | Notes |
---|---|---|---|
service_dashboard_url | str | URL that points to a dashboard with relevant graphs about the entire service. | [optional] [default to null] |
service_dashboard_embedding_url | str | URL that points to a dashboard with relevant graphs about the entire service for embedding. | [optional] [default to null] |
serve_deployment_dashboard_url | str | URL that points to a dashboard with relevant graphs about a single deployent or replica of a service. | [optional] [default to null] |
serve_deployment_dashboard_embedding_url | str | URL that points to a dashboard with relevant graphs about a single deployent or replica of a service for embedding. | [optional] [default to null] |
ServiceSortField
An enumeration.
Possible Values: ['STATUS', 'NAME', 'CREATED_AT']
ServiceType
An enumeration.
Possible Values: ['V1', 'V2']
ServiceVersionState
The possible 'current state' values for a service version. These states are used in the UI and SDK/CLI.
Possible Values: ['UNKNOWN', 'STARTING', 'UPDATING', 'RUNNING', 'UNHEALTHY', 'SYSTEM_FAILURE', 'TERMINATING', 'TERMINATED']
ServicemodelListResponse
A list response form the API. Contains a field "results" which has the contents of the response.
Name | Type | Description | Notes |
---|---|---|---|
results | List[ServiceModel] | [default to null] | |
metadata | ListResponseMetadata | [optional] [default to null] |
ServicemodelResponse
A response from the API. Contains a field "result" which has the contents of the response.
Name | Type | Description | Notes |
---|---|---|---|
result | ServiceModel | [default to null] |