Parameter description
All classes of parameters are converted to dictionary objects containing the attribute information.
Parameter | Type | Description |
---|---|---|
cluster | str, CreateResponse | Cluster ID |
group_name | str | Instance group name of the cluster |
strategy | str | Spot strategy of the cluster. It takes effect only when ResourceType is Spot.Values: SpotWithPriceLimit (Set the maximum price for the spot instance) and SpotAsPriceGo (The system provides a price automatically, and the maximum value is the Pay-As-You-Go price) |
price_limit | str | Maximum price of an instance per hour. The value can contain at most three decimals. It takes effect when SpotStrategy is SpotWithPriceLimit |
Response description
The change_cluster_spot_config method returns an ActionResponse
object. ActionResponse
provides only two attributes: request ID and status code.
Example
try:
# Init a Client object.
client = ...
# Refer to ClusterDescription.
cluster_desc = ClusterDescription(...)
cluster = client.create_cluster(cluster_desc)
# Print out the cluster id.
print (cluster.Id)
client.change_cluster_spot_config(cluster.Id, group_name="group1", strategy="SpotWithPriceLimit", price_limit=0.9)
except ClientError, e:
print (e)