hostName = (String)properties.get("hostName");
inputPath = (String)properties.get("inputPath");
}
public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
MessageContext inputNew = new MessageContext();
try{
if(jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT) == null){
try {
GFACSSHUtils.addSecurityContext(jobExecutionContext);
} catch (ApplicationSettingsException e) {
log.error(e.getMessage());
throw new GFacHandlerException("Error while creating SSHSecurityContext", e, e.getLocalizedMessage());
}
}
ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext()
.getApplicationDeploymentDescription().getType();
AuthenticationInfo authenticationInfo = null;
if (password != null) {
authenticationInfo = new DefaultPasswordAuthenticationInfo(this.password);
} else {
authenticationInfo = new DefaultPublicKeyFileAuthentication(this.publicKeyPath, this.privateKeyPath,
this.passPhrase);
}
// Server info
ServerInfo serverInfo = new ServerInfo(this.userName, this.hostName);
Cluster pbsCluster = null;
// here doesn't matter what the job manager is because we are only doing some file handling
// not really dealing with monitoring or job submission, so we pa
pbsCluster = new PBSCluster(serverInfo, authenticationInfo, CommonUtils.getPBSJobManager("/opt/torque/torque-4.2.3.1/bin/"));
String parentPath = inputPath + File.separator + jobExecutionContext.getExperimentID() + File.separator + jobExecutionContext.getTaskData().getTaskID();
(new File(parentPath)).mkdirs();
MessageContext input = jobExecutionContext.getInMessageContext();
Set<String> parameters = input.getParameters().keySet();
for (String paramName : parameters) {
ActualParameter actualParameter = (ActualParameter) input.getParameters().get(paramName);
String paramValue = MappingFactory.toString(actualParameter);
//TODO: Review this with type
if ("URI".equals(actualParameter.getType().getType().toString())) {
((URIParameterType) actualParameter.getType()).setValue(stageInputFiles(pbsCluster, paramValue, parentPath));
} else if ("URIArray".equals(actualParameter.getType().getType().toString())) {