runqLock.releaseLock();
logger.warning(runId + " is empty. Waiting !!");
return null;
}
RunId runIdObj = new RunId(runId);
BenchmarkDescription benchDesc =
BenchmarkDescription.getDescription(runIdObj.getBenchName());
String runDir = Config.RUNQ_DIR + runId;
String outDir = Config.OUT_DIR + runId;
// Create output directory
File outDirFile = new File(outDir);
outDirFile.mkdir();
// Create the metadata directory
File metaInfFile = new File(outDirFile, "META-INF");
metaInfFile.mkdir();
String metaInf = metaInfFile.getAbsolutePath() + File.separator;
String sourceParamFile =
runDir + File.separator + benchDesc.configFileName;
String destParamFile =
outDir + File.separator + benchDesc.configFileName;
// Copy whole META-INF dir.
File srcMetaInf = new File(runDir, "META-INF");
if (srcMetaInf.isDirectory())
for (String metaFile : srcMetaInf.list()) {
FileHelper.copyFile(srcMetaInf.getAbsolutePath() +
File.separator + metaFile, metaInf + metaFile, false);
}
if (Config.SECURITY_ENABLED) {
File submitter = new File(outDir + File.separator + "META-INF" +
File.separator + "submitter");
if (!submitter.isFile()) {
logger.warning("Unidentified submitter. Removing run " +
runId + '.');
FileHelper.recursiveDelete(new File(Config.RUNQ_DIR), runId);
runqLock.releaseLock();
throw new RunEntryException("Unidentified submitter on run " +
runId + '.');
}
}
if (!FileHelper.copyFile(sourceParamFile, destParamFile, false)) {
logger.warning("Error copying Parameter Repository. " +
"Removing run " + runId + '.');
FileHelper.recursiveDelete(new File(Config.RUNQ_DIR), runId);
runqLock.releaseLock();
throw new RunEntryException("Error run param file on run " +
runId + '.');
}
FileHelper.recursiveDelete(new File(Config.RUNQ_DIR), runId);
runqLock.releaseLock();
uploadTags(runId);
return new Run(runIdObj.getRunSeq(), benchDesc);
}