全部产品
Search
文档中心

:修改集群竞价选项

更新时间:Sep 22, 2022

描述

修改集群竞价选项(change_cluster_spot_config)。

参数说明

所有类型的参数将被转换为包含属性信息的字典对象。

参数

类型

描述

cluster

str, CreateResponse

集群的标示符

group_name

str

集群的实例组名

strategy

str

集群的竞价策略,只有在ResourceType为Spot的情况下有效。取值范围:SpotWithPriceLimit:设置上限价格的竞价实例;SpotAsPriceGo:系统自动出价,最高按量付费价格。

price_limit

str

实例的每小时最高价格。支持最大 3 位小数,SpotStrategy 为 SpotWithPriceLimit 生效。

返回值说明

change_cluster_spot_config方法将返回一个 ActionResponse 对象, ActionResponse仅提供了request ID和状态码两个属性。

示例

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)