Azure-Samples / azure-batch-samples

Azure Batch and HPC Code Samples
Other
261 stars 487 forks source link

How to upload applicationPackage to be installed on each node of the pool #287

Open jGuru opened 4 years ago

jGuru commented 4 years ago

The Java SDK only has methods to create logical application package reference on the portal but do not have any method to upload .zip file for the application. i.e. I wanted to create a new batch account with .zip file in my local. How can I do that?

Thanks

bgklein commented 4 years ago

Using Java you can create application packages with azure-mgmt-batch

            BatchAccount batchAccount = azure.batchAccounts().define(batchAccountName)
                    .withRegion(region)
                    .withNewResourceGroup(rgName)
                    .defineNewApplication(applicationName)
                        .defineNewApplicationPackage(applicationPackageName)
                        .withAllowUpdates(true)
                        .withDisplayName(applicationDisplayName)
                        .attach()
                    .withNewStorageAccount(storageAccountName)
                    .create();

Once it is created you can do a get operation on the ApplicationPackage to get the storage url to upload your bits to (with the storage SDK).

Then you need to call activate on the ApplicationPackage

jGuru commented 4 years ago

Thanks for your response. I have created the batch account already with the above-given code. I will explore the Storage SDK then will get back to you.