3

I can create a pool with an autoscale formula fine. The code for this is as follows.

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();

However if once the pool exists, I try and update the AutoScale formula, I get an error. The error is

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

The code is

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();

This used to work before I updated to the latest version of the Azure Batch library. Has anyone got any experience of Azure Batch and can advise why I'm getting this error?

Nuri Tasdemir
  • 9,720
  • 3
  • 42
  • 67
NZJames
  • 4,963
  • 15
  • 50
  • 100

1 Answers1

2

You can use the PoolOperations.EnableAutoScale method directly. For your example, you could use the following:

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