All Products
Search
Document Center

change_cluster_spot_config

Last Updated: May 14, 2018

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

  1. try:
  2. # Init a Client object.
  3. client = ...
  4. # Refer to ClusterDescription.
  5. cluster_desc = ClusterDescription(...)
  6. cluster = client.create_cluster(cluster_desc)
  7. # Print out the cluster id.
  8. print (cluster.Id)
  9. client.change_cluster_spot_config(cluster.Id, group_name="group1", strategy="SpotWithPriceLimit", price_limit=0.9)
  10. except ClientError, e:
  11. print (e)