Azure Batch: execute Java processes

Roberto Sidoti 21 Reputation points

I'm looking at Azure Batch in order to let it executes on a distributed pool of VMs a set of Business Rules. I've seen that there is a Java SDK but it's not clear where I've to put "my business logic". I've seen that Java SDK let me define and instantiate a pool, define a Job and define for the Job a set of Tasks.

Once I've defined a Task it's not clear how can I execute "the business logic" that requires to read/write on Azure Sql?
I've figured out that I can do that

TaskAddParameter taskToAdd = new TaskAddParameter();
taskToAdd.withId("mytask").withCommandLine(String.format("<execute a java program (JARs) uploaded on the pool item"));

Is it correct?

Azure SQL Database
Azure Batch
Azure Batch
An Azure service that provides cloud-scale job scheduling and compute management.
320 questions
{count} votes

Accepted answer
  1. prmanhas-MSFT 17,901 Reputation points Microsoft Employee

    @Roberto Sidoti Apologies for the delay in response and all the inconvenience caused because of the issue.

    Below is the response from our internal team:

    From my understanding you are saying you have already created your pool and are familiar with using resource files to get your JARs onto the node via either the task or pool resourceFiles.

    You will likely want to install the JRE as part of a StartTask on the node. If you are on Ubuntu a command line similar to ‘/bin/bash -c “sudo apt-get install default-jre”’ will likely suffice. Then if your resourceFiles are on your task, the files should directly be in the path you specified from the working directory so you should be able to set your command line to something along the lines of ‘/bin/bash -c “java -jar path/to/file.jar”. In Windows you would do a similar command for the tasks but preface it with cmd /c instead of /bin/bash -c, and then changing the start task to install the JRE using the windows commandline.

    Hope it helps!!!

    Please 'Accept as answer' if it helped, so that it can help others in the community looking for help on similar topics

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful