requiredslots not updating in azurebatch

Shruti Devurkar 21 Reputation points
2022-08-04T11:04:46.377+00:00

How to set requiredslots in batch?

var standaloneTask = {
id: 'standalone',
commandLine: 'bash -c "$SW/standalone.sh"',
requiredSlots: 2, // does not reflect, always shows 1
userIdentity: {
autoUser: {
elevationLevel: 'admin'
}
},
};
return batchClient.task.add(jobid, standaloneTask).then(function (result) {
return batchClient.task.add(jobid, nexusTask).catch((err) => {
console.log(err)
});

Azure Batch
Azure Batch
An Azure service that provides cloud-scale job scheduling and compute management.
302 questions
0 comments No comments
{count} votes

Accepted answer
  1. vipullag-MSFT 23,946 Reputation points Microsoft Employee
    2022-08-10T13:47:28.42+00:00

    @Shruti Devurkar

    Thanks for confirming on the nodejs part. There was a change and the old NodeJS-specific libraries are deprecated. The ones you should be using for Batch are @azure/arm-batch (for ARM calls to accounts, pools, etc) and @azure/batch for direct calls to the Batch service (Jobs, Tasks, etc)

    I believe the old azure-arm-batch and azure-batch packages point to this codebase, which is deprecated: https://github.com/azure/azure-sdk-for-node the ones starting with @azure point here: https://github.com/azure/azure-sdk-for-js

    Also, please try upgrading the library and see if that helps.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. vipullag-MSFT 23,946 Reputation points Microsoft Employee
    2022-08-08T05:20:28.543+00:00

    @Shruti Devurkar

    Welcome to Microsoft Q&A Platform, thanks for posting your query here.

    Looks like you are using the Javascript SDK, I would request you to check and make sure you are using a recent version that supports the requiredSlots property. Anything 10.0.1 or above should have this property (10.1.0 is the most recent).

    Please refer this document once.

    CloudTask task = new CloudTask(taskId, taskCommandLine)  
    {  
        RequiredSlots = 2  
    };  
      
    {  
      "id": "taskId",  
      "commandLine": "bash -c 'echo hello'",  
      "userIdentity": {  
        "autoUser": {  
          "scope": "task",  
          "elevationLevel": "nonadmin"  
        }  
      },  
      "requiredSLots": 2  
    }  
    

    Hope this helps.
    If you need further help on this, tag me in a comment.
    If the suggested response helped you resolve your issue, please 'Accept as answer', so that it can help others in the community looking for help on similar topics.