Skip to content

Commit ce1a53a

Browse files
authored
Update the Node.Js sample to latest SDK. (#282)
1 parent 840a7e4 commit ce1a53a

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

Node.js/GettingStarted/nodejs_batch_client_sample.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
// Importing required node.js modules
22
var batch = require('azure-batch');
3-
var uuid = require('node-uuid');
43

54
// Replace values below with Batch Account details
65
var accountName = '<batch-account-name>';
76
var accountKey = '<batch-account-key>';
87
var accountUrl = '<batch-account-url>';
98

109
// Replace values with SAS URIs of the shell script file
11-
var sh_url = "https://batchdevsgsa.blob.core.windows.net/downloads/startup_prereq.sh?st=2017-04-10T18%3A11%3A00Z&se=2018-03-11T18%3A11%3A00Z&sp=rl&sv=2015-12-11&sr=b&sig=TEGlekTbAlGAqInp3m4ZEAAyHdE5NwGQQaJVmxcg5AE%3D";
10+
var sh_url = "https://batchdevsgsa.blob.core.windows.net/downloads/startup_prereq.sh?st=2017-04-10T18%3A11%3A00Z&se=2020-03-11T18%3A11%3A00Z&sp=rl&sv=2018-03-28&sr=b&sig=xxxx";
1211

1312
// Replace values with SAS URIs of the Python script file
14-
var scriptURI = "https://batchdevsgsa.blob.core.windows.net/downloads/processcsv.py?st=2017-04-10T18%3A11%3A00Z&se=2018-03-11T18%3A11%3A00Z&sp=rl&sv=2015-12-11&sr=b&sig=ngeN60AzqSc%2Bugx2H7XUbiNXysb1%2BMvuW%2Fk8FhsU3KU%3D";
13+
var scriptURI = "https://batchdevsgsa.blob.core.windows.net/downloads/processcsv.py?st=2017-04-10T18%3A11%3A00Z&se=2020-03-11T18%3A11%3A00Z&sp=rl&sv=2018-03-28&sr=b&sig=xxxx";
1514

1615
// Pool ID
1716
var now = new Date();
@@ -29,20 +28,20 @@ var batchClient = new batch.ServiceClient(credentials,accountUrl);
2928
// Pool VM Image Reference
3029
var imgRef = {publisher:"Canonical",
3130
offer:"UbuntuServer",
32-
sku:"14.04.2-LTS",
31+
sku:"16.04-LTS",
3332
version:"latest"}
3433
// Pool VM configuraion object
3534
var vmConfig = {imageReference:imgRef,
36-
nodeAgentSKUId:"batch.node.ubuntu 14.04"};
35+
nodeAgentSKUId:"batch.node.ubuntu 16.04"};
3736
// Number of VMs to create in a pool
3837
var numVms = 4;
39-
var vmSize = "STANDARD_A1";
38+
var vmSize = "STANDARD_D1_V2";
4039
// Pool configuration object
4140
var poolConfig = {id:poolId,
4241
displayName:"Processing csv files",
4342
vmSize:vmSize,
4443
virtualMachineConfiguration:vmConfig,
45-
targetDedicated:numVms,
44+
targetDedicatedNodes:numVms,
4645
enableAutoScale:false };
4746

4847
// Creating Batch Pool
@@ -67,7 +66,7 @@ function createJob()
6766
// Preparation Task configuraion object
6867
var jobPrepTaskConfig = {id:"installprereq",
6968
commandLine:"sudo sh startup_prereq.sh > startup.log",
70-
resourceFiles:[{'blobSource':sh_url,'filePath':'startup_prereq.sh'}],
69+
resourceFiles:[{'httpUrl':sh_url,'filePath':'startup_prereq.sh'}],
7170
waitForSuccess:true,runElevated:true};
7271

7372
// Setting Batch Pool ID
@@ -106,7 +105,7 @@ function createTasks()
106105
var taskConfig = {id:taskID,
107106
displayName:'process csv in ' + containerName,
108107
commandLine:'python processcsv.py --container ' + containerName,
109-
resourceFiles:[{'blobSource':scriptURI,'filePath':'processcsv.py'}]};
108+
resourceFiles:[{'httpUrl':scriptURI,'filePath':'processcsv.py'}]};
110109

111110
var task = batchClient.task.add(jobId,taskConfig,function(error,result){
112111
if(error !== null)

Node.js/GettingStarted/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"version": "1.0.0",
44
"description": "Getting started sample in Node.js for deploying Azure batch jobs",
55
"dependencies": {
6-
"azure-batch": "1.0.0-prev",
7-
"node-uuid": "1.4.8"
6+
"azure-batch": "^8.0.0",
7+
"package.json": "^2.0.1"
88
},
99
"main": "nodejs_batch_client_sample.js",
1010
"scripts": {

0 commit comments

Comments
 (0)