Skip to content

Commit 59e47dd

Browse files
authored
Merge pull request MicrosoftDocs#1761 from JJJessieWang/wangje-batch-update-doc
Update Batch overview page
2 parents f4a9cea + 1e8b944 commit 59e47dd

File tree

1 file changed

+32
-21
lines changed

1 file changed

+32
-21
lines changed

docs-ref-services/latest/batch.md

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
---
2-
title: Azure Batch SDK for Python
3-
description: Reference for Azure Batch SDK for Python
4-
author: jingjlii
5-
ms.author: jingjli
6-
ms.data: 06/28/2023
7-
ms.topic: reference
8-
ms.devlang: python
9-
ms.service: batch
10-
---
1+
---
2+
title: Azure Batch SDK for Python
3+
description: Reference for Azure Batch SDK for Python
4+
author: jingjlii
5+
ms.author: jingjli
6+
ms.date: 06/28/2023
7+
ms.topic: reference
8+
ms.devlang: python
9+
ms.service: batch
10+
---
11+
1112
# Azure Batch libraries for python
1213

1314
## Overview
@@ -29,27 +30,37 @@ pip install azure-batch
2930
Set up a pool of Linux compute nodes in a batch account:
3031

3132
```python
33+
import azure.batch
34+
from azure.batch import batch_auth, BatchServiceClient, models
35+
3236
# create the batch client for an account using its URI and keys
33-
creds = batchauth.SharedKeyCredentials(account, key)
34-
config = batch.BatchServiceClientConfiguration(creds, base_url = batch_url)
35-
client = batch.BatchServiceClient(config)
37+
creds = batch_auth.SharedKeyCredentials(account, key)
38+
client = BatchServiceClient(creds, batch_url)
3639

3740
# Create the VirtualMachineConfiguration, specifying
3841
# the VM image reference and the Batch node agent to
3942
# be installed on the node.
40-
vmc = batchmodels.VirtualMachineConfiguration(
41-
image_reference = ir,
42-
node_agent_sku_id = "batch.node.ubuntu 14.04")
43+
vmc = models.VirtualMachineConfiguration(
44+
image_reference = models.ImageReference(
45+
publisher='Canonical',
46+
offer='UbuntuServer',
47+
sku='18.04-LTS'
48+
),
49+
node_agent_sku_id = "batch.node.ubuntu 18.04")
4350

4451
# Assign the virtual machine configuration to the pool
45-
new_pool.virtual_machine_configuration = vmc
52+
new_pool = models.PoolAddParameter(
53+
id = 'new_pool',
54+
vm_size='standard_d2_v2',
55+
virtual_machine_configuration = vmc
56+
)
4657

4758
# Create pool in the Batch service
4859
client.pool.add(new_pool)
4960
```
5061

5162
> [!div class="nextstepaction"]
52-
> [Explore the Client APIs](/python/api/overview/azure/batch/client)
63+
> [Explore the Client APIs](/python/api/azure-batch)
5364
5465
## Management API
5566
Use the Azure Batch management libraries to create and delete batch accounts, read and regenerate batch account keys, and manage batch account storage.
@@ -88,13 +99,13 @@ storage_account = storage_async_operation.result()
8899

89100
# Create a Batch Account, specifying the storage account we want to link
90101
storage_resource = storage_account.id
91-
batch_account = azure.mgmt.batch.models.BatchAccountCreateParameters(
102+
batch_account_parameters = azure.mgmt.batch.models.BatchAccountCreateParameters(
92103
location=LOCATION,
93104
auto_storage=azure.mgmt.batch.models.AutoStorageBaseProperties(storage_resource)
94105
)
95-
creating = batch_client.account.create('MyBatchAccount', LOCATION, batch_account)
106+
creating = batch_client.batch_account.begin_create('MyBatchResourceGroup', 'MyBatchAccount', batch_account_parameters)
96107
creating.wait()
97108
```
98109

99110
> [!div class="nextstepaction"]
100-
> [Explore the Management APIs](/python/api/overview/azure/batch/management)
111+
> [Explore the Management APIs](/python/api/overview/azure/mgmt-batch-readme)

0 commit comments

Comments
 (0)