boolean submitJob = false;
boolean getStatus = false;
String submitJobFile = null;
String jobid = null;
HamaConfiguration conf = new HamaConfiguration(getConf());
init(conf);
if ("-list".equals(cmd)) {
if (args.length != 1 && !(args.length == 2 && "all".equals(args[1]))) {
displayUsage(cmd);
return exitCode;
}
if (args.length == 2 && "all".equals(args[1])) {
listAllJobs = true;
} else {
listJobs = true;
}
} else if ("-list-active-grooms".equals(cmd)) {
if (args.length != 1) {
displayUsage(cmd);
return exitCode;
}
listActiveGrooms = true;
} else if ("-submit".equals(cmd)) {
if (args.length == 1) {
displayUsage(cmd);
return exitCode;
}
submitJob = true;
submitJobFile = args[1];
} else if ("-kill".equals(cmd)) {
if (args.length == 1) {
displayUsage(cmd);
return exitCode;
}
killJob = true;
jobid = args[1];
} else if ("-status".equals(cmd)) {
if (args.length != 2) {
displayUsage(cmd);
return exitCode;
}
jobid = args[1];
getStatus = true;
// TODO Later, below functions should be implemented
// with the Fault Tolerant mechanism.
} else if ("-list-attempt-ids".equals(cmd)) {
System.out.println("This function is not implemented yet.");
return exitCode;
} else if ("-kill-task".equals(cmd)) {
System.out.println("This function is not implemented yet.");
return exitCode;
} else if ("-fail-task".equals(cmd)) {
System.out.println("This function is not implemented yet.");
return exitCode;
}
BSPJobClient jc = new BSPJobClient(new HamaConfiguration());
if (listJobs) {
listJobs();
exitCode = 0;
} else if (listAllJobs) {
listAllJobs();
exitCode = 0;
} else if (listActiveGrooms) {
listActiveGrooms();
exitCode = 0;
} else if (submitJob) {
HamaConfiguration tConf = new HamaConfiguration(new Path(submitJobFile));
RunningJob job = jc.submitJob(new BSPJob(tConf));
System.out.println("Created job " + job.getID().toString());
} else if (killJob) {
RunningJob job = jc.getJob(BSPJobID.forName(jobid));
if (job == null) {