public QueueStatusBean run(String user, String id)
throws NotAuthorizedException, BadParam, IOException, InterruptedException
{
UserGroupInformation ugi = UgiFactory.getUgi(user);
WebHCatJTShim tracker = null;
JobState state = null;
try {
tracker = ShimLoader.getHadoopShims().getWebHCatShim(appConf, ugi);
JobID jobid = StatusDelegator.StringToJobID(id);
if (jobid == null)
throw new BadParam("Invalid jobid: " + id);
tracker.killJob(jobid);
state = new JobState(id, Main.getAppConfigInstance());
List<JobState> children = state.getChildren();
if (children != null) {
for (JobState child : children) {
try {
tracker.killJob(StatusDelegator.StringToJobID(child.getId()));
} catch (IOException e) {
LOG.warn("templeton: fail to kill job " + child.getId());
}
}
}
return StatusDelegator.makeStatus(tracker, jobid, state);
} catch (IllegalStateException e) {
throw new BadParam(e.getMessage());
} finally {
if (tracker != null)
tracker.close();
if (state != null)
state.close();
}
}