public static final String SLURM_JOB_MANAGER = "slurm";
public static final String SUN_GRID_ENGINE_JOB_MANAGER = "sge";
public static void addSecurityContext(JobExecutionContext jobExecutionContext) throws GFacException, ApplicationSettingsException {
RequestData requestData = new RequestData("default");
GSISecurityContext context = null;
try {
//todo fix this
context = new GSISecurityContext(null, requestData);
} catch (Exception e) {
throw new GFacException("An error occurred while creating GSI security context", e);
}
HostDescription registeredHost = jobExecutionContext.getApplicationContext().getHostDescription();
if (registeredHost.getType() instanceof GlobusHostType || registeredHost.getType() instanceof UnicoreHostType
|| registeredHost.getType() instanceof SSHHostType) {
logger.error("This is a wrong method to invoke to non ssh host types,please check your gfac-config.xml");
} else if (registeredHost.getType() instanceof GsisshHostType) {
GSIAuthenticationInfo authenticationInfo
= new MyProxyAuthenticationInfo(requestData.getMyProxyUserName(), requestData.getMyProxyPassword(), requestData.getMyProxyServerUrl(),
requestData.getMyProxyPort(), requestData.getMyProxyLifeTime(), System.getProperty(Constants.TRUSTED_CERTIFICATE_SYSTEM_PROPERTY));
GsisshHostType gsisshHostType = (GsisshHostType) registeredHost.getType();
ServerInfo serverInfo = new ServerInfo(requestData.getMyProxyUserName(), registeredHost.getType().getHostAddress(),
gsisshHostType.getPort());
Cluster pbsCluster = null;
try {
JobManagerConfiguration jConfig = null;
String installedParentPath = ((HpcApplicationDeploymentType)
jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType()).getInstalledParentPath();
String jobManager = ((GsisshHostType) registeredHost.getType()).getJobManager();
if (jobManager == null) {
logger.error("No Job Manager is configured, so we are picking pbs as the default job manager");
jConfig = CommonUtils.getPBSJobManager(installedParentPath);
} else {
if (PBS_JOB_MANAGER.equalsIgnoreCase(jobManager)) {
jConfig = CommonUtils.getPBSJobManager(installedParentPath);
} else if (SLURM_JOB_MANAGER.equalsIgnoreCase(jobManager)) {
jConfig = CommonUtils.getSLURMJobManager(installedParentPath);
} else if (SUN_GRID_ENGINE_JOB_MANAGER.equalsIgnoreCase(jobManager)) {
jConfig = CommonUtils.getSGEJobManager(installedParentPath);
}
}
pbsCluster = new PBSCluster(serverInfo, authenticationInfo, jConfig);
} catch (SSHApiException e) {
throw new GFacException("An error occurred while creating GSI security context", e);
}
context.setPbsCluster(pbsCluster);
}
jobExecutionContext.addSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT,context);
}