Skip to main content

Service API Reference (Legacy)

Service API Reference (Legacy)

warning

These APIs are legacy and deprecated. Please use the current APIs instead.

Service CLI

anyscale service rollout Deprecated

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.

ParamTypeDescription
auth_tokenOptional StringAuthentication 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

NameTypeDescriptionNotes
service_idstrDefaults to null

Returns ServicemodelResponse

rollback_service

Rollback a Service

Parameters

NameTypeDescriptionNotes
service_idstrDefaults to null
rollback_service_modelRollbackServiceModel

Returns ServicemodelResponse

rollout_service

Rollout a service

Parameters

NameTypeDescriptionNotes
apply_service_modelApplyServiceModel

Returns ServicemodelResponse

terminate_service

Terminate a Service

Parameters

NameTypeDescriptionNotes
service_idstrDefaults to null

Returns ServicemodelResponse

list_services

Parameters

NameTypeDescriptionNotes
project_idoptional strproject_id to filter byDefaults to null
nameoptional strname to filter byDefaults to null
state_filterList[ServiceEventCurrentState]A list of Service states to filter byDefaults to []
archive_statusArchiveStatusThe archive status to filter by. Defaults to unarchived.Defaults to null
creator_idoptional strcreator_id to filter byDefaults to null
cloud_idoptional strcloud_id to filter byDefaults to null
sort_fieldServiceSortFieldIf absent, the default sorting order is 1. status (active first).2. Last updated at (desc). 3. Name (asc).Defaults to null
sort_orderSortOrderIf sort_field is absent, this field is ignored.If absent, this field defaults to ascending.Defaults to null
paging_tokenoptional strDefaults to null
countoptional intDefaults to null

Returns ServicemodelListResponse

Service Models

ApplyProductionServiceV2Model

DEPRECATED. Please do not use this model directly. Use ApplyServiceModel.

NameTypeDescriptionNotes
namestrName of the Service[default to null]
descriptionstrDescription of the Service[optional] [default to null]
project_idstrId of the project this Service will start clusters in[optional] [default to null]
versionstrA 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_percentintA 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_configobjectThe 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_idstrThe id of the cluster env build. This id will determine the docker image your Service is run using.[default to null]
compute_config_idstrThe 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]
configServiceConfigTarget Service's configuration[optional] [default to null]
rollout_strategyRolloutStrategyStrategy 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_configRayGCSExternalStorageConfigConfig 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_configTracingConfigConfig for initializing tracing within Anyscale runtime.[optional] [default to null]
auto_complete_rolloutboolFlag to indicate whether or not to complete the rollout after the canary version reaches 100%.[optional] [default to true]
max_surge_percentintMax amount of excess capacity allocated during the rollout (0-100).[optional] [default to null]

ApplyServiceModel

This is the model used to apply a Service.

NameTypeDescriptionNotes
namestrName of the Service[default to null]
descriptionstrDescription of the Service[optional] [default to null]
project_idstrId of the project this Service will start clusters in[optional] [default to null]
versionstrA 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_percentintA 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_configobjectThe 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_idstrThe id of the cluster env build. This id will determine the docker image your Service is run using.[default to null]
compute_config_idstrThe 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]
configServiceConfigTarget Service's configuration[optional] [default to null]
rollout_strategyRolloutStrategyStrategy 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_configRayGCSExternalStorageConfigConfig 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_configTracingConfigConfig for initializing tracing within Anyscale runtime.[optional] [default to null]
auto_complete_rolloutboolFlag to indicate whether or not to complete the rollout after the canary version reaches 100%.[optional] [default to true]
max_surge_percentintMax 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.

NameTypeDescriptionNotes
idstr[default to null]
namestr[default to null]
creator_idstrId of the user who created the Service[default to null]
created_atdatetimeTime the Service was created[default to null]
project_idstrId of the project this Service will start clusters in. This configuration cannot be changed after the service is created.[default to null]
current_stateServiceEventCurrentStateThe current state of this service[default to null]
endtimedatetime[optional] [default to null]
typeServiceTypeType of the Service[optional] [default to null]
service_observability_urlsServiceObservabilityUrlsA 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.

NameTypeDescriptionNotes
resultsList[ListServiceModel][default to null]
metadataListResponseMetadata[optional] [default to null]

ProductionServiceV2Model

DEPRECATED. Please use ServiceModel with new sdk calls.

NameTypeDescriptionNotes
idstrId of the Service[default to null]
namestrName of the Service[default to null]
descriptionstrDescription of the Service[optional] [default to null]
project_idstrId of the project this Service will start clusters in. This configuration cannot be changed after the service is created.[default to null]
cloud_idstrId of the cloud this Service belongs to, and will launch clusters in. This configuration cannot be changed.[default to null]
creator_idstrId of the user who created the Service[default to null]
created_atdatetimeTime the Service was created[default to null]
hostnamestrThe hostname of the service[default to null]
current_stateServiceEventCurrentStateThe current state of this service[default to null]
goal_stateServiceGoalStatesThe goal state of this service[default to null]
auth_tokenstrToken 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_enabledboolWhether or not the service is using auto rollout[default to null]
versionsList[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_versionProductionServiceV2VersionModelPrimary version of this service. If the service is terminated, this field refers to the most recently active version.[default to null]
canary_versionProductionServiceV2VersionModelCanary version of this service. Present only if the service is in the `ROLLING_OUT` state.[optional] [default to null]
service_observability_urlsServiceObservabilityUrlsA JSON object with useful urls pointing to Grafana dashboards.[default to null]
base_urlstrThe base url of this service[default to null]
ended_atdatetimeTime the Service was terminated[optional] [default to null]

ProductionServiceV2VersionModel

NameTypeDescriptionNotes
idstrId of the Service Version[default to null]
created_atdatetimeTime the version was created[default to null]
weightintThe target percentage of traffic sent to this version. This is a number between 0 and 100.[default to null]
current_weightintThe current percentage of traffic sent to this version. This is a number between 0 and 100.[optional] [default to null]
versionstrThe version string identifier for this version[default to null]
ray_serve_configobject[default to null]
ray_gcs_external_storage_configRayGCSExternalStorageConfigConfig 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_configTracingConfigConfig for initializing tracing within Anyscale runtime.[optional] [default to null]
build_idstrThe id of the cluster env build. This id will determine the docker image your Service is run using.[default to null]
compute_config_idstrThe 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_idsList[str]The list of production job ids associated with this service version.[default to null]
current_stateServiceVersionStateThe 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.

NameTypeDescriptionNotes
resultProductionServiceV2Model[default to null]

RollbackServiceModel

The rollback model for Services.

NameTypeDescriptionNotes
max_surge_percentintThe max_surge_percent to use when rolling back.[optional] [default to null]

RolloutStrategy

An enumeration.

Possible Values: ['ROLLOUT', 'IN_PLACE']

ServiceConfig

NameTypeDescriptionNotes
max_uptime_timeout_secintAuto-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]
accessAccessConfigAccess configuration[optional] [default to null]
protocolsProtocolsProtocol setups for the service[optional] [default to null]
env_varsobjectEnvironment 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.

NameTypeDescriptionNotes
idstrId of the Service[default to null]
namestrName of the Service[default to null]
descriptionstrDescription of the Service[optional] [default to null]
project_idstrId of the project this Service will start clusters in. This configuration cannot be changed after the service is created.[default to null]
cloud_idstrId of the cloud this Service belongs to, and will launch clusters in. This configuration cannot be changed.[default to null]
creator_idstrId of the user who created the Service[default to null]
created_atdatetimeTime the Service was created[default to null]
hostnamestrThe hostname of the service[default to null]
current_stateServiceEventCurrentStateThe current state of this service[default to null]
goal_stateServiceGoalStatesThe goal state of this service[default to null]
auth_tokenstrToken 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_enabledboolWhether or not the service is using auto rollout[default to null]
versionsList[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_versionProductionServiceV2VersionModelPrimary version of this service. If the service is terminated, this field refers to the most recently active version.[default to null]
canary_versionProductionServiceV2VersionModelCanary version of this service. Present only if the service is in the `ROLLING_OUT` state.[optional] [default to null]
service_observability_urlsServiceObservabilityUrlsA JSON object with useful urls pointing to Grafana dashboards.[default to null]
base_urlstrThe base url of this service[default to null]
ended_atdatetimeTime the Service was terminated[optional] [default to null]

ServiceObservabilityUrls

NameTypeDescriptionNotes
service_dashboard_urlstrURL that points to a dashboard with relevant graphs about the entire service.[optional] [default to null]
service_dashboard_embedding_urlstrURL that points to a dashboard with relevant graphs about the entire service for embedding.[optional] [default to null]
serve_deployment_dashboard_urlstrURL 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_urlstrURL 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.

NameTypeDescriptionNotes
resultsList[ServiceModel][default to null]
metadataListResponseMetadata[optional] [default to null]

ServicemodelResponse

A response from the API. Contains a field "result" which has the contents of the response.

NameTypeDescriptionNotes
resultServiceModel[default to null]