-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCreateandRunBatch.azcli
47 lines (42 loc) · 1.32 KB
/
CreateandRunBatch.azcli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#Creating Batch account with Azure CLI
az batch account create \
--name mybatchaccount \
--storage-account mystorageaccount \
--resource-group myResourceGroup \
--location eastus2
az batch account login \
--name mybatchaccount \
--resource-group myResourceGroup \
--shared-key-auth
#Creating Batch pools and jobs with Azure CLI
az batch pool create \
--id mypool --vm-size Standard_A1_v2 \
--target-dedicated-nodes 2 \
--image canonical:ubuntuserver:16.04-LTS \
--node-agent-sku-id "batch.node.ubuntu 16.04"
az batch pool show --pool-id mypool \
--query "allocationState"
az batch job create \
--id myjob \
--pool-id mypool
#Running Batch jobs with Azure CLI
for i in {1..4}
do
az batch task create \
--task-id mytask$i \
--job-id myjob \
--command-line "/bin/bash -c 'printenv | grep AZ_BATCH; sleep 90s'"
done
#Viewing Batch job output with Azure CLI
az batch task show \
--job-id myjob \
--task-id mytask1
az batch task file list \
--job-id myjob \
--task-id mytask1 \
--output table
az batch task file download \
--job-id myjob \
--task-id mytask1 \
--file-path stdout.txt \
--destination ./stdout.txt