if (job.getType() == null) {
job.setType("normal");
}
Expr expression = jobAd.lookup(Jdl.ENVIRONMENT);
if (expression != null && expression instanceof ListExpr) {
Iterator item = ((ListExpr) expression).iterator();
while (item.hasNext()) {
String tmps = ((Constant) item.next()).stringValue();
String[] tokens = tmps.split("=", 2);
job.addEnvironmentAttribute(tokens[0].trim(), tokens[1].trim());
}
}
job.setNodeNumber(1);
expression = jobAd.lookup(Jdl.CPUNUMB);
if (expression != null) {
if (expression.type != Expr.INTEGER || expression.intValue() <= 0) {
throw new Exception("wrong value for " + Jdl.CPUNUMB + ": it must be >=1");
}
job.setNodeNumber(expression.intValue());
} else {
expression = jobAd.lookup(Jdl.NODENUMB);
if (expression != null) {
if (expression.type != Expr.INTEGER || expression.intValue() <= 0) {
throw new Exception("wrong value for " + Jdl.NODENUMB + ": it must be >=1");
}
job.setNodeNumber(expression.intValue());
}
}
boolean wholeNodes = false;
expression = jobAd.lookup(Jdl.WHOLE_NODES);
if (expression != null && expression.type == Expr.BOOLEAN && expression.isTrue()) {
wholeNodes = true;
}
job.addExtraAttribute(Jdl.WHOLE_NODES, Boolean.toString(wholeNodes));
expression = jobAd.lookup(Jdl.SMP_GRANULARITY);
if (expression != null) {
if (expression.type != Expr.INTEGER || expression.intValue() <= 0) {
throw new Exception("wrong value for " + Jdl.SMP_GRANULARITY + ": it must be >=1");
}
job.addExtraAttribute(Jdl.SMP_GRANULARITY, "" + expression.intValue());
}
expression = jobAd.lookup(Jdl.HOST_NUMBER);
if (expression != null) {
if (expression.type != Expr.INTEGER || expression.intValue() <= 0) {
throw new Exception("wrong value for " + Jdl.HOST_NUMBER + ": it must be >=1");
}
job.addExtraAttribute(Jdl.HOST_NUMBER, "" + expression.intValue());
}
if (!wholeNodes && job.containsExtraAttribute(Jdl.SMP_GRANULARITY) && job.containsExtraAttribute(Jdl.HOST_NUMBER)) {
throw new Exception("the SMPGranularity and HostNumber attributes cannot be specified together when WholeNodes=false");
}
expression = jobAd.lookup("PerusalFileEnable");
if (expression != null && expression.type == Expr.BOOLEAN && expression.isTrue()) {
expression = jobAd.lookup("PerusalTimeInterval");
if (expression != null && expression instanceof Constant) {
job.setPerusalTimeInterval(expression.intValue());
} else {
job.setPerusalTimeInterval(5);
}
job.setPerusalFilesDestURI(getAttributeValue(jobAd, "PerusalFilesDestURI"));
job.setPerusalListFileURI(getAttributeValue(jobAd, "PerusalListFileURI"));