簡體   English   中英

池存在后更新Azure Batch自動縮放公式

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM