Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature #317

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 21 additions & 20 deletions Java/PoolAndResourceFile/src/main/java/PoolAndResourceFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
public class PoolAndResourceFile {

// Get Batch and storage account information from environment
static String BATCH_ACCOUNT = System.getenv("AZURE_BATCH_ACCOUNT");
static String BATCH_ACCESS_KEY = System.getenv("AZURE_BATCH_ACCESS_KEY");
static String BATCH_URI = System.getenv("AZURE_BATCH_ENDPOINT");
static String STORAGE_ACCOUNT_NAME = System.getenv("STORAGE_ACCOUNT_NAME");
static String STORAGE_ACCOUNT_KEY = System.getenv("STORAGE_ACCOUNT_KEY");
static String BATCH_ACCOUNT = "metlife"; //System.getenv("AZURE_BATCH_ACCOUNT")
static String BATCH_ACCESS_KEY = "a7+xnp0ECqN28DXqv2VmoapYQolTF0c7CriBMzxabgma4vfiha+Uffp0fbEGF1qVxdZ/tU4t9Wu6+ABa+eeYkQ=="; //System.getenv("AZURE_BATCH_ACCESS_KEY");
static String BATCH_URI = "metlife.eastus.batch.azure.com"; //System.getenv("AZURE_BATCH_ENDPOINT");
static String STORAGE_ACCOUNT_NAME = "metlifepoc"; //System.getenv("STORAGE_ACCOUNT_NAME");
static String STORAGE_ACCOUNT_KEY = "SxJZ9lzgO+O+pzPX0zqA89xhKpUQ3OLvDMHOyxSO3V0PwE2sUN+LEcESJPjtBma3989DGJlDIIKT+ASt/o80tw=="; //System.getenv("STORAGE_ACCOUNT_KEY");
static String STORAGE_CONTAINER_NAME = "poolandresourcefile";


// How many tasks to run across how many nodes
static int TASK_COUNT = 5;
static int NODE_COUNT = 1;
Expand Down Expand Up @@ -111,9 +112,9 @@ public static void main(String[] argv) throws Exception {
private static CloudPool createPoolIfNotExists(BatchClient client, String poolId)
throws BatchErrorException, IllegalArgumentException, IOException, InterruptedException, TimeoutException {
// Create a pool with 1 A1 VM
String osPublisher = "OpenLogic";
String osOffer = "CentOS";
String poolVMSize = "STANDARD_A1";
String osPublisher = "canonical";
String osOffer = "ubuntuserver";
String poolVMSize = "standard_a1_v2";
int poolVMCount = 1;
Duration poolSteadyTimeout = Duration.ofMinutes(5);
Duration vmReadyTimeout = Duration.ofMinutes(20);
Expand Down Expand Up @@ -338,17 +339,17 @@ private static void waitForTasksToComplete(BatchClient client, String jobId, Dur
throw new TimeoutException("Task did not complete within the specified timeout");
}

private static void printBatchException(BatchErrorException err) {
System.out.printf("BatchError %s%n", err.toString());
if (err.body() != null) {
System.out.printf("BatchError code = %s, message = %s%n", err.body().code(),
err.body().message().value());
if (err.body().values() != null) {
for (BatchErrorDetail detail : err.body().values()) {
System.out.printf("Detail %s=%s%n", detail.key(), detail.value());
}
}
}
}
// private static void printBatchException(BatchErrorException err) {
// System.out.printf("BatchError %s%n", err.toString());
// if (err.body() != null) {
// System.out.printf("BatchError code = %s, message = %s%n", err.body().code(),
// err.body().message().value());
// if (err.body().values() != null) {
// for (BatchErrorDetail detail : err.body().values()) {
// System.out.printf("Detail %s=%s%n", detail.key(), detail.value());
// }
// }
// }
// }

}