use of org.apache.airavata.gfac.impl.job.LSFJobConfiguration in project airavata by apache.
the class Factory method getJobManagerConfiguration.
public static JobManagerConfiguration getJobManagerConfiguration(ResourceJobManager resourceJobManager) throws GFacException {
if (resourceJobManager == null)
return null;
ResourceConfig resourceConfig = Factory.getResourceConfig(resourceJobManager.getResourceJobManagerType());
OutputParser outputParser;
try {
Class<? extends OutputParser> aClass = Class.forName(resourceConfig.getCommandOutputParser()).asSubclass(OutputParser.class);
outputParser = aClass.getConstructor().newInstance();
} catch (Exception e) {
throw new GFacException("Error while instantiating output parser for " + resourceJobManager.getResourceJobManagerType().name());
}
String templateFileName = GFacUtils.getTemplateFileName(resourceJobManager.getResourceJobManagerType());
switch(resourceJobManager.getResourceJobManagerType()) {
case PBS:
return new PBSJobConfiguration(templateFileName, ".pbs", resourceJobManager.getJobManagerBinPath(), resourceJobManager.getJobManagerCommands(), outputParser);
case SLURM:
return new SlurmJobConfiguration(templateFileName, ".slurm", resourceJobManager.getJobManagerBinPath(), resourceJobManager.getJobManagerCommands(), outputParser);
case LSF:
return new LSFJobConfiguration(templateFileName, ".lsf", resourceJobManager.getJobManagerBinPath(), resourceJobManager.getJobManagerCommands(), outputParser);
case UGE:
return new UGEJobConfiguration(templateFileName, ".pbs", resourceJobManager.getJobManagerBinPath(), resourceJobManager.getJobManagerCommands(), outputParser);
case FORK:
return new ForkJobConfiguration(templateFileName, ".sh", resourceJobManager.getJobManagerBinPath(), resourceJobManager.getJobManagerCommands(), outputParser);
// We don't have a job configuration manager for CLOUD type
default:
return null;
}
}
Aggregations