return 1;
}
// -------- build the packaged program -------------
PackagedProgram program;
try {
program = buildProgram(line);
} catch (Throwable t) {
return handleError(t);
}
if (program == null) {
printHelpForInfo();
return 1;
}
int parallelism = -1;
if (line.hasOption(PARALLELISM_OPTION.getOpt())) {
String parString = line.getOptionValue(PARALLELISM_OPTION.getOpt());
try {
parallelism = Integer.parseInt(parString);
} catch (NumberFormatException e) {
System.out.println("The value " + parString + " is invalid for the degree of parallelism.");
printHelpForRun();
return 1;
}
if (parallelism <= 0) {
System.out.println("Invalid value for the degree-of-parallelism. Parallelism must be greater than zero.");
printHelpForRun();
return 1;
}
}
try {
// check for description request
if (description) {
String descr = program.getDescription();
if (descr != null) {
System.out.println("-------------------- Program Description ---------------------");
System.out.println(descr);
System.out.println("--------------------------------------------------------------");
} else {
System.out.println("No description available for this program.");
}
}
// check for json plan request
if (plan) {
Client client = getClient(line, program.getUserCodeClassLoader());
String jsonPlan = client.getOptimizedPlanAsJson(program, parallelism);
if (jsonPlan != null) {
System.out.println("----------------------- Execution Plan -----------------------");
System.out.println(jsonPlan);
System.out.println("--------------------------------------------------------------");
} else {
System.out.println("JSON plan could not be compiled.");
}
}
return 0;
}
catch (Throwable t) {
return handleError(t);
}
finally {
program.deleteExtractedLibraries();
}
}