Skip to content

Commit b2090fc

Browse files
committed
Updated from feedback
1 parent 34d1e07 commit b2090fc

File tree

3 files changed

+46
-23
lines changed

3 files changed

+46
-23
lines changed

batch/manage-pool/manage-pool.sh batch/manage-pool/manage-pool-linux.sh

+9-22
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,36 @@
33
# Authenticate Batch account CLI session.
44
az batch account login -g myresource group -n mybatchaccount
55

6-
# Create a new Windows PaaS pool with 3 Standard A1 VMs.
7-
az batch pool create \
8-
--id mypool-windows \
9-
--os-family 4 \
10-
--target-dedicated 3 \
11-
--vm-size small \
12-
13-
# We can add some metadata to the pool.
14-
az batch pool set --pool-id mypool-windows --metadata IsWindows=true VMSize=StandardA1
15-
16-
# Retrieve a list of available IaaS images and node agent SKUs
6+
# Retrieve a list of available images and node agent SKUs.
177
az batch pool node-agent-skus list
188

19-
# Create a new Linux IaaS pool with an application reference and a start task that will
20-
# copy the application files to a shared directory. The image reference and node agent SKUs
21-
# ID can be selected from the ouptputs of the above list command.
9+
# Create a new Linux pool with a virtual machine configuration. The image reference
10+
# and node agent SKUs ID can be selected from the ouptputs of the above list command.
2211
# The image reference is in the format: {publisher}:{offer}:{sku}:{version} where {version} is
2312
# optional and will default to 'latest'.
2413
az batch pool create \
2514
--id mypool-linux \
2615
--vm-size Standard_A1 \
2716
--image canonical:ubuntuserver:16.04.0-LTS \
28-
--node-agent-sku-id batch.node.ubuntu 16.04 \
29-
--start-task-command-line "cmd /c xcopy %AZ_BATCH_APP_PACKAGE_MYAPP% %AZ_BATCH_NODE_SHARED_DIR%" \
30-
--start-task-wait-for-success \
31-
--application-package-references myapp
17+
--node-agent-sku-id batch.node.ubuntu 16.04
3218

33-
# Now lets resize the IaaS pool to start up some VMs.
19+
# Now let's resize the pool to start up some VMs.
3420
az batch pool resize --pool-id mypool-linux --target-dedicated 5
3521

36-
# We can check the status of the pool to see when it has finished resizing
22+
# We can check the status of the pool to see when it has finished resizing.
3723
az batch pool show --pool-id mypool-linux
3824

3925
# List the compute nodes running in a pool.
4026
az batch node list --pool-id mypool-linux
4127

4228
# If a particular node in the pool is having issues, it can be rebooted or reimaged.
4329
# The ID of the node can be retrieved with the list command above.
44-
az batch node reboot --pool-id mypool-linux --node-id node1
30+
# A typical node ID will be in the format 'tvm-xxxxxxxxxx_1-<timestamp>'.
31+
az batch node reboot --pool-id mypool-linux --node-id tvm-123_1-20170316t000000z
4532

4633
# Alternatively, one or more compute nodes can be deleted from the pool, and any
4734
# work already assigned to it can be re-allocated to another node.
4835
az batch node delete \
4936
--pool-id mypool-linux \
50-
--node-list node1 node2 \
37+
--node-list tvm-123_1-20170316t000000z tvm-123_2-20170316t000000z \
5138
--node-deallocation-option requeue
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
# Authenticate Batch account CLI session.
4+
az batch account login -g myresource group -n mybatchaccount
5+
6+
# We want to add an application package reference to the pool, so first
7+
# we'll list the available applications.
8+
az batch application summary list
9+
10+
# Create a new Windows cloud service platform pool with 3 Standard A1 VMs.
11+
# The pool has an application package reference (taken from the output of the
12+
# above command) and a start task that will copy the application files to a shared directory.
13+
az batch pool create \
14+
--id mypool-windows \
15+
--os-family 4 \
16+
--target-dedicated 3 \
17+
--vm-size small \
18+
--start-task-command-line "cmd /c xcopy %AZ_BATCH_APP_PACKAGE_MYAPP% %AZ_BATCH_NODE_SHARED_DIR%" \
19+
--start-task-wait-for-success \
20+
--application-package-references myapp
21+
22+
# We can add some metadata to the pool.
23+
az batch pool set --pool-id mypool-windows --metadata IsWindows=true VMSize=StandardA1
24+
25+
# Let's change the pool to enable automatic scaling of compute nodes.
26+
# This autoscale formula specifies that the number of nodes should be adjusted according
27+
# to the number of active tasks, up to a maximum of 10 compute nodes.
28+
az batch pool autoscale enable \
29+
--pool-id mypool-windows \
30+
--auto-scale-formula "$averageActiveTaskCount = avg($ActiveTasks.GetSample(TimeInterval_Minute * 15));$TargetDedicated = min(10, $averageActiveTaskCount);"
31+
32+
# We can monitor the resizing of the pool.
33+
az batch pool show --pool-id mypool-windows
34+
35+
# Once we no longer require the pool to automatically scale, we can disable it.
36+
az batch pool autoscale disable --pool-id mypool-windows

batch/run-job/run-job.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ az batch task create \
1818
--command-line "cmd /c %AZ_BATCH_APP_PACKAGE_MYAPP#1.0%\\myapp.exe"
1919

2020
# If we want to add many tasks at once - this can be done by specifying the tasks
21-
# in a JSON file, and passing it into the command. See all_tasks.json for formatting.
21+
# in a JSON file, and passing it into the command. See tasks.json for formatting.
2222
az batch task create --job-id myjob --json-file tasks.json
2323

2424
# Now that all the tasks are added - we can update the job so that it will automatically

0 commit comments

Comments
 (0)