[英]Updating Azure Batch autoscale formula once pool exists
我可以创建一个自动缩放公式很好的池。 的代码如下。
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();
但是,如果池一旦存在,我尝试更新AutoScale公式,则会收到错误消息。 错误是
{“当对象处于绑定状态时,不能修改属性AutoScaleFormula。”}
该代码是
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批处理库的最新版本之前,这种方法一直有效。 有没有人有任何Azure Batch的经验,可以告诉我为什么会出现此错误?
您可以直接使用PoolOperations.EnableAutoScale方法。 对于您的示例,可以使用以下代码:
var client = BatchClient.Open(GetCloudSharedKeyCredentials(primary));
client.Pooloperations.EnableAutoScale(poolName, formula, TimeSpan.FromMinutes(5));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.