public void onStart(JsvManager jsv) {
log.info("Starting job verification");
}
public void onVerify(JsvManager jsv) {
JobDescription job = jsv.getJobDescription();
Map<String,String> res = job.getHardResourceRequirements();
String path = null;
if ((res != null) && res.containsKey(PATH_KEY)) {
path = res.get(PATH_KEY);
} else if ((res != null) && res.containsKey(PATH_KEY_SHORT)) {
path = res.get(PATH_KEY_SHORT);
}
if (path != null) {
if (verifyPath(path)) {
Map<String,String> soft = job.getSoftResourceRequirements();
try {
Collection<LocatedBlock> blocks = null;
blocks = getBlocks(path, getConf());
// Add new requests
soft.putAll(buildRackRequests(blocks));
soft.putAll(buildBlockRequests(blocks));
job.setSoftResourceRequirements(soft);
// Remove old request
res.remove(PATH_KEY);
res.remove(PATH_KEY_SHORT);
job.setHardResourceRequirements(res);
} catch (FileNotFoundException e) {
jsv.reject("The requested data path does not exist: " + path);
} catch (IOException e) {
log.warning("Unable to contact Namenode: " + StringUtils.stringifyException(e));
jsv.log(JsvManager.LogLevel.ERROR, "Unable to contact Namenode: " + e.getMessage());