if(!outputDataDir.isEmpty()){
jobAttr.addEnvVariable(outputDataDir, appExecContext.getExecutionModel().getOutputDataDir());
}
ApplicationDescriptionType app = appExecContext.getExecutionModel().getAplicationDesc();
WorkflowContextHeader contextHeader = appExecContext.getWorkflowHeader();
ResourceMapping resourceMapping = null;
if (contextHeader != null) {
resourceMapping = contextHeader.getResourceMappings().getResourceMappingArray(0);
}
log.info("Configure using App Desc = " + app.xmlText());
if (resourceMapping != null && resourceMapping.getMaxWallTime() > 0) {
log.info("Header Setting Max Wall Time" + resourceMapping.getMaxWallTime());
jobAttr.setMaxWallTime(resourceMapping.getMaxWallTime());
} else if (app.getMaxWallTime() > 0) {
log.info("Setting max wall clock time to " + app.getMaxWallTime());
if (app.getMaxWallTime() > 30 && app.getQueue() != null && app.getQueue().equals("debug")) {
throw new GfacException("NCSA debug Queue only support jobs < 30 minutes", FaultCode.InvalidConfig);
}
jobAttr.setMaxWallTime(app.getMaxWallTime());
jobAttr.set("proxy_timeout", "1");
} else {
jobAttr.setMaxWallTime(29);
}
if (appExecContext.getExecutionModel().getStdIn() != null) {
jobAttr.setStdin(appExecContext.getExecutionModel().getStdIn());
} else {
Iterator<String> values = appExecContext.getExecutionModel().getInputParameters().iterator();
while (values.hasNext()) {
jobAttr.addArgument(values.next());
}
}
if (resourceMapping != null && resourceMapping.getNodeCount() > 0) {
log.info("Setting number of procs to " + resourceMapping.getNodeCount());
jobAttr.set("hostCount", String.valueOf(resourceMapping.getNodeCount()));
}else if (app.getHostCount() > 1) {
jobAttr.set("hostCount", String.valueOf(app.getHostCount()));
}
if (resourceMapping != null && resourceMapping.getCpuCount() > 0) {
log.info("Setting host count to " + resourceMapping.getCpuCount());
jobAttr.setNumProcs(resourceMapping.getCpuCount());
} else if (app.getCount() > 1) {
log.info("Setting number of procs to " + app.getCount());
jobAttr.setNumProcs(app.getCount());
}
if (app.getProject() != null && app.getProject().getProjectName() != null) {
log.info("Setting project to " + app.getProject());
jobAttr.setProject(app.getProject().getProjectName());
}
if (resourceMapping != null && resourceMapping.getQueueName() != null) {
jobAttr.setQueue(resourceMapping.getQueueName());
} else if (app.getQueue() != null && app.getQueue().getQueueName() != null) {
log.info("Setting job queue to " + app.getQueue());
jobAttr.setQueue(app.getQueue().getQueueName());
}
String jobType = JobType.SINGLE.toString() ;