存在池时更新Azure Batch自动缩放公式

时间:2016-06-27 13:34:22

标签: c# .net azure azure-batch

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

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 Batch库的最新版本之前,这已经过去了。有没有人有Azure Batch的经验,可以告诉我为什么会收到这个错误?

1 个答案:

答案 0 :(得分:0)

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

public function destroy(RequestEvent $event)
{
    $event->delete();
    return redirect()->route('your_home_route');
}