gpt4 book ai didi

c# - 池存在后更新 Azure Batch 自动缩放公式

转载 作者:行者123 更新时间:2023-12-05 05:23:19 25 4
gpt4 key购买 nike

我可以使用自动缩放公式创建一个池。其代码如下。

var pool = client.PoolOperations.CreatePool(poolName, vmsize, new CloudServiceConfiguration(osFamily, osVersion));
pool.TaskSchedulingPolicy = new TaskSchedulingPolicy(ComputeNodeFillType.Pack);
pool.AutoScaleFormula = autoscaleFormula;
pool.AutoScaleEnabled = true;
pool.AutoScaleEvaluationInterval = new TimeSpan(0, 0, 5, 0);
pool.Commit();

但是,如果池存在后,我尝试更新自动缩放公式,则会收到错误。错误是

{"The property AutoScaleFormula cannot be modified while the object is in the Bound state."}

代码是

var client = BatchClient.Open(GetCloudSharedKeyCredentials(primary));
var pool = client.PoolOperations.GetPool(poolName);
pool.AutoScaleFormula = formula;
pool.AutoScaleEnabled = true;
pool.AutoScaleEvaluationInterval = new TimeSpan(0, 0, 5, 0);
pool.Commit();

在我更新到最新版本的 Azure Batch 库之前,这曾经有效。有谁有 Azure Batch 的经验并可以告诉我为什么会收到此错误吗?

最佳答案

您可以直接使用PoolOperations.EnableAutoScale方法。对于您的示例,您可以使用以下内容:

var client = BatchClient.Open(GetCloudSharedKeyCredentials(primary));
client.Pooloperations.EnableAutoScale(poolName, formula, TimeSpan.FromMinutes(5));

关于c# - 池存在后更新 Azure Batch 自动缩放公式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38055391/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com