Skip to content

Commit 6f331e8

Browse files
committed
Initial Track 2 conversion
1 parent 17fa81b commit 6f331e8

File tree

3 files changed

+268
-251
lines changed

3 files changed

+268
-251
lines changed

Java/PoolAndResourceFile/README.md

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,36 @@ platforms: java
77
When run, this sample will:
88

99
- Create an Azure Batch pool with a single dedicated node
10-
- Wait for the nodes to be ready
10+
- Wait for the node to be ready
1111
- Create a storage container and upload a resource file to it
1212
- Submit a job with 5 tasks associated with the resource file
1313
- Wait for all tasks to finish
1414
- Delete the job, the pool and the storage container
1515

16-
## Running this Sample
17-
To run this sample:
16+
## Prerequisites
1817

19-
Set the following environment variables:
20-
- `AZURE_BATCH_ACCOUNT` -- The Batch account name.
21-
- `AZURE_BATCH_ACCESS_KEY` -- The Batch account key.
22-
- `AZURE_BATCH_ENDPOINT` -- The Batch account endpoint.
23-
- `STORAGE_ACCOUNT_NAME` -- The storage account to hold resource files.
24-
- `STORAGE_ACCOUNT_KEY` -- The storage account key.
18+
- Configure both an Azure Batch account and an Azure Storage account in the same region.
2519

26-
Clone repo and compile the code:
20+
- Set the following environment variables:
21+
- `AZURE_RESOURCE_GROUP_NAME` -- The resource group of the Batch account.
22+
- `AZURE_BATCH_ACCOUNT_NAME` -- The name of the Batch account.
23+
- `AZURE_BLOB_SERVICE_URL` -- The blob service URL of the Storage account.
2724

28-
git clone https://github.com/Azure/azure-batch-samples.git
25+
- Ensure you have the [Azure CLI](https://learn.microsoft.com/cli/azure/) installed and run the following commands,
26+
replacing `<subscription_id>` with your Azure subscription ID. When running the `az login` command, make sure
27+
you are authenticating as a user with appropriate permissions to both the Batch account and Storage account.
28+
```shell
29+
az login
30+
az account set -s <subscription_id>
31+
```
2932

30-
cd azure-batch-samples/Java/PoolAndResourceFile
33+
**Note:** The sample code uses [DefaultAzureCredential](https://github.com/Azure/azure-sdk-for-java/wiki/Azure-Identity-Examples#authenticating-with-defaultazurecredential),
34+
which supports a wide variety of authentication methods, not just the Azure CLI. Any of these other methods should work
35+
as long as the user or service principal has the appropriate permissions.
3136

32-
mvn clean compile exec:java
37+
## Running the sample
38+
Run the following command from the same directory as this README to compile and run the sample:
39+
40+
```shell
41+
mvn clean compile exec:java
42+
```

Java/PoolAndResourceFile/pom.xml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,34 @@
1515

1616
<dependencies>
1717
<dependency>
18-
<groupId>com.microsoft.azure</groupId>
19-
<artifactId>azure-batch</artifactId>
20-
<version>9.0.0</version>
18+
<groupId>com.azure</groupId>
19+
<artifactId>azure-compute-batch</artifactId>
20+
<version>1.0.0-beta.1</version>
2121
</dependency>
2222
<dependency>
23-
<groupId>com.microsoft.rest</groupId>
24-
<artifactId>client-runtime</artifactId>
25-
<version>1.7.12</version>
23+
<groupId>com.azure</groupId>
24+
<artifactId>azure-core-http-netty</artifactId>
25+
<version>1.14.2</version>
2626
</dependency>
2727
<dependency>
28-
<groupId>com.microsoft.azure</groupId>
29-
<artifactId>azure-client-runtime</artifactId>
30-
<version>1.7.12</version>
28+
<groupId>com.azure</groupId>
29+
<artifactId>azure-identity</artifactId>
30+
<version>1.12.0</version>
3131
</dependency>
3232
<dependency>
33-
<groupId>commons-codec</groupId>
34-
<artifactId>commons-codec</artifactId>
35-
<version>1.15</version>
33+
<groupId>com.azure.resourcemanager</groupId>
34+
<artifactId>azure-resourcemanager-batch</artifactId>
35+
<version>1.1.0-beta.4</version>
3636
</dependency>
3737
<dependency>
38-
<groupId>com.microsoft.azure</groupId>
39-
<artifactId>azure-storage</artifactId>
40-
<version>8.6.6</version>
38+
<groupId>com.azure</groupId>
39+
<artifactId>azure-storage-blob</artifactId>
40+
<version>12.21.1</version>
41+
</dependency>
42+
<dependency>
43+
<groupId>org.slf4j</groupId>
44+
<artifactId>slf4j-simple</artifactId>
45+
<version>2.0.13</version>
4146
</dependency>
4247
</dependencies>
4348

0 commit comments

Comments
 (0)