airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject [1/2] airavata git commit: resolved storage resource precedency inside the process context- fixed AIRAVATA-2252, use credential token part of session caching key- fixes AIRAVATA-2284
Date Mon, 19 Dec 2016 17:00:11 GMT
Repository: airavata
Updated Branches:
  refs/heads/develop 2cb5ebc3c -> 445e14950


http://git-wip-us.apache.org/repos/asf/airavata/blob/445e1495/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/job/PBSOutputParser.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/job/PBSOutputParser.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/job/PBSOutputParser.java
index d7d52ee..73bbdac 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/job/PBSOutputParser.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/job/PBSOutputParser.java
@@ -20,6 +20,7 @@
 */
 package org.apache.airavata.gfac.impl.job;
 
+import org.apache.airavata.gfac.core.GFacException;
 import org.apache.airavata.gfac.core.SSHApiException;
 import org.apache.airavata.gfac.core.cluster.OutputParser;
 import org.apache.airavata.model.status.JobStatus;
@@ -118,7 +119,7 @@ public class PBSOutputParser implements OutputParser {
     }
 
     @Override
-    public String parseJobId(String jobName, String rawOutput) throws SSHApiException {
+    public String parseJobId(String jobName, String rawOutput) throws GFacException {
         /* output will look like
         Job Id: 2080802.gordon-fe2.local
             Job_Name = A312402627

http://git-wip-us.apache.org/repos/asf/airavata/blob/445e1495/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/job/SlurmOutputParser.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/job/SlurmOutputParser.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/job/SlurmOutputParser.java
index e94afc5..a37e065 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/job/SlurmOutputParser.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/job/SlurmOutputParser.java
@@ -20,6 +20,7 @@
 */
 package org.apache.airavata.gfac.impl.job;
 
+import org.apache.airavata.gfac.core.GFacException;
 import org.apache.airavata.gfac.core.SSHApiException;
 import org.apache.airavata.gfac.core.cluster.OutputParser;
 import org.apache.airavata.model.status.JobState;
@@ -46,7 +47,7 @@ public class SlurmOutputParser implements OutputParser {
      * @param rawOutput
      * @return
      */
-    public String parseJobSubmission(String rawOutput) throws SSHApiException {
+    public String parseJobSubmission(String rawOutput) throws GFacException {
 	    log.info(rawOutput);
 	    Pattern pattern = Pattern.compile("Submitted batch job (?<" + JOBID + ">[^\\s]*)");
 	    Matcher matcher = pattern.matcher(rawOutput);
@@ -63,7 +64,7 @@ public class SlurmOutputParser implements OutputParser {
         return matcher.find();
     }
 
-    public JobStatus parseJobStatus(String jobID, String rawOutput) throws SSHApiException
{
+    public JobStatus parseJobStatus(String jobID, String rawOutput) throws GFacException
{
         log.info(rawOutput);
         Pattern pattern = Pattern.compile(jobID + "(?=\\s+\\S+\\s+\\S+\\s+\\S+\\s+(?<"
+ STATUS + ">\\w+))");
         Matcher matcher = pattern.matcher(rawOutput);
@@ -73,7 +74,7 @@ public class SlurmOutputParser implements OutputParser {
         return null;
     }
 
-    public void parseJobStatuses(String userName, Map<String, JobStatus> statusMap,
String rawOutput) throws SSHApiException {
+    public void parseJobStatuses(String userName, Map<String, JobStatus> statusMap,
String rawOutput) throws GFacException {
         log.debug(rawOutput);
         String[] info = rawOutput.split("\n");
         String lastString = info[info.length - 1];
@@ -114,7 +115,7 @@ public class SlurmOutputParser implements OutputParser {
     }
 
     @Override
-    public String parseJobId(String jobName, String rawOutput) throws SSHApiException {
+    public String parseJobId(String jobName, String rawOutput) throws GFacException {
         String regJobId = "jobId";
         if (jobName == null) {
             return null;

http://git-wip-us.apache.org/repos/asf/airavata/blob/445e1495/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/job/UGEOutputParser.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/job/UGEOutputParser.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/job/UGEOutputParser.java
index 31a70db..ecce6f9 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/job/UGEOutputParser.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/job/UGEOutputParser.java
@@ -20,6 +20,7 @@
 */
 package org.apache.airavata.gfac.impl.job;
 
+import org.apache.airavata.gfac.core.GFacException;
 import org.apache.airavata.gfac.core.SSHApiException;
 import org.apache.airavata.gfac.core.cluster.OutputParser;
 import org.apache.airavata.model.status.JobState;
@@ -95,7 +96,7 @@ public class UGEOutputParser implements OutputParser {
     }
 
     @Override
-    public String parseJobId(String jobName, String rawOutput) throws SSHApiException {
+    public String parseJobId(String jobName, String rawOutput) throws GFacException {
         if (jobName.length() > 10) {
             jobName = jobName.substring(0, 10);
         }

http://git-wip-us.apache.org/repos/asf/airavata/blob/445e1495/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/ArchiveTask.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/ArchiveTask.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/ArchiveTask.java
index df22654..d60a0ff 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/ArchiveTask.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/ArchiveTask.java
@@ -23,11 +23,9 @@ package org.apache.airavata.gfac.impl.task;
 import com.jcraft.jsch.ChannelExec;
 import com.jcraft.jsch.JSchException;
 import com.jcraft.jsch.Session;
-import org.apache.airavata.common.exception.AiravataException;
 import org.apache.airavata.common.utils.AiravataUtils;
 import org.apache.airavata.common.utils.ThriftUtils;
 import org.apache.airavata.gfac.core.GFacException;
-import org.apache.airavata.gfac.core.SSHApiException;
 import org.apache.airavata.gfac.core.authentication.AuthenticationInfo;
 import org.apache.airavata.gfac.core.cluster.CommandInfo;
 import org.apache.airavata.gfac.core.cluster.CommandOutput;
@@ -40,7 +38,6 @@ import org.apache.airavata.gfac.core.task.Task;
 import org.apache.airavata.gfac.core.task.TaskException;
 import org.apache.airavata.gfac.impl.Factory;
 import org.apache.airavata.gfac.impl.StandardOutReader;
-import org.apache.airavata.model.appcatalog.gatewayprofile.StoragePreference;
 import org.apache.airavata.model.appcatalog.storageresource.StorageResourceDescription;
 import org.apache.airavata.model.commons.ErrorModel;
 import org.apache.airavata.model.status.TaskState;
@@ -96,27 +93,20 @@ public class ArchiveTask implements Task {
 
         try {
             StorageResourceDescription storageResource = taskContext.getParentProcessContext().getStorageResource();
-            StoragePreference storagePreference = taskContext.getParentProcessContext().getStoragePreference();
 
             if (storageResource != null) {
                 hostName = storageResource.getHostName();
             } else {
                 throw new GFacException("Storage Resource is null");
             }
-
-            if (storagePreference != null) {
-                userName = storagePreference.getLoginUserName();
-                inputPath = storagePreference.getFileSystemRootLocation();
-                inputPath = (inputPath.endsWith(File.separator) ? inputPath : inputPath +
File.separator);
-            } else {
-                throw new GFacException("Storage Preference is null");
-            }
-
+            userName = processContext.getStorageResourceLoginUserName();
+            inputPath = processContext.getStorageFileSystemRootLocation();
+            inputPath = (inputPath.endsWith(File.separator) ? inputPath : inputPath + File.separator);
 
             authenticationInfo = Factory.getStorageSSHKeyAuthentication(taskContext.getParentProcessContext());
             status = new TaskStatus(TaskState.COMPLETED);
 
-            ServerInfo serverInfo = new ServerInfo(userName, hostName, DEFAULT_SSH_PORT);
+            ServerInfo serverInfo = processContext.getStorageResourceServerInfo();
             Session sshSession = Factory.getSSHSession(authenticationInfo, serverInfo);
             URI sourceURI = new URI(subTaskModel.getSource());
             URI destinationURI = null;
@@ -151,7 +141,7 @@ public class ArchiveTask implements Task {
                     " && tar -xvf " + archiveTar + " -C " + storageArchiveDir + "
&& rm " + archiveTar +
                     " && chmod 755 -R " + storageArchiveDir + "/*");
             executeCommand(sshSession, commandInfo, new StandardOutReader());
-        } catch (GFacException | AiravataException | URISyntaxException | SSHApiException
e) {
+        } catch ( URISyntaxException | GFacException e) {
             String msg = "Error! Archive task failed";
             log.error(msg, e);
             status.setState(TaskState.FAILED);
@@ -178,7 +168,7 @@ public class ArchiveTask implements Task {
 
 
 
-    private void executeCommand(Session session,CommandInfo commandInfo, CommandOutput commandOutput)
throws SSHApiException {
+    private void executeCommand(Session session,CommandInfo commandInfo, CommandOutput commandOutput)
throws GFacException {
         String command = commandInfo.getCommand();
         ChannelExec channelExec = null;
         try {
@@ -195,7 +185,7 @@ public class ArchiveTask implements Task {
             channelExec.connect();
             commandOutput.onOutput(channelExec);
         } catch (JSchException e) {
-            throw new SSHApiException("Unable to execute command - ", e);
+            throw new GFacException("Unable to execute command - ", e);
         }finally {
             //Only disconnecting the channel, session can be reused
             if (channelExec != null) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/445e1495/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/BESJobSubmissionTask.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/BESJobSubmissionTask.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/BESJobSubmissionTask.java
index 990b9ea..15f0764 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/BESJobSubmissionTask.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/BESJobSubmissionTask.java
@@ -252,9 +252,8 @@ public class BESJobSubmissionTask implements JobSubmissionTask {
         String remoteFilePath = null, fileName = null, localFilePath = null;
         try {
             authenticationInfo = Factory.getStorageSSHKeyAuthentication(pc);
-            ServerInfo serverInfo = new ServerInfo(userName, hostName, DEFAULT_SSH_PORT);
+            ServerInfo serverInfo = pc.getComputeResourceServerInfo();
             Session sshSession = Factory.getSSHSession(authenticationInfo, serverInfo);
-
             for (OutputDataObjectType output : copyOutput) {
                 switch (output.getType()) {
                     case STDERR: case STDOUT: case STRING: case URI:
@@ -273,7 +272,7 @@ public class BESJobSubmissionTask implements JobSubmissionTask {
                         break;
                 }
             }
-        } catch (IOException | JSchException | AiravataException | SSHApiException | URISyntaxException
e) {
+        } catch (IOException | JSchException | SSHApiException | URISyntaxException e) {
             log.error("Error while coping local file " + localFilePath + " to remote " +
remoteFilePath, e);
             throw new GFacException("Error while scp output files to remote storage file
location", e);
         }
@@ -282,27 +281,20 @@ public class BESJobSubmissionTask implements JobSubmissionTask {
     private void copyInputFilesToLocal(TaskContext taskContext) throws GFacException {
         ProcessContext pc = taskContext.getParentProcessContext();
         StorageResourceDescription storageResource = pc.getStorageResource();
-        StoragePreference storagePreference = pc.getStoragePreference();
 
         if (storageResource != null) {
             hostName = storageResource.getHostName();
         } else {
             throw new GFacException("Storage Resource is null");
         }
-
-        if (storagePreference != null) {
-            userName = storagePreference.getLoginUserName();
-            inputPath = storagePreference.getFileSystemRootLocation();
-            inputPath = (inputPath.endsWith(File.separator) ? inputPath : inputPath + File.separator);
-        } else {
-            throw new GFacException("Storage Preference is null");
-        }
+        inputPath = pc.getStorageFileSystemRootLocation();
+        inputPath = (inputPath.endsWith(File.separator) ? inputPath : inputPath + File.separator);
 
         String remoteFilePath = null, fileName = null, localFilePath = null;
         URI remoteFileURI = null;
         try {
             authenticationInfo = Factory.getStorageSSHKeyAuthentication(pc);
-            ServerInfo serverInfo = new ServerInfo(userName, hostName, DEFAULT_SSH_PORT);
+            ServerInfo serverInfo = pc.getStorageResourceServerInfo();
             Session sshSession = Factory.getSSHSession(authenticationInfo, serverInfo);
 
             List<InputDataObjectType> processInputs = pc.getProcessModel().getProcessInputs();
@@ -317,7 +309,7 @@ public class BESJobSubmissionTask implements JobSubmissionTask {
                     input.setValue("file:/" + localFilePath);
                 }
             }
-        } catch (IOException | JSchException | AiravataException | SSHApiException | URISyntaxException
e) {
+        } catch (IOException | JSchException | SSHApiException | URISyntaxException e) {
             log.error("Error while coping remote file " + remoteFilePath + " to local " +
localFilePath, e);
             throw new GFacException("Error while scp input files to local file location",
e);
         }

http://git-wip-us.apache.org/repos/asf/airavata/blob/445e1495/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DataStageTask.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DataStageTask.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DataStageTask.java
index 8c6a125..942012b 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DataStageTask.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DataStageTask.java
@@ -20,6 +20,7 @@
  */
 package org.apache.airavata.gfac.impl.task;
 
+import org.apache.airavata.gfac.core.GFacException;
 import org.apache.airavata.gfac.core.SSHApiException;
 import org.apache.airavata.gfac.core.context.TaskContext;
 import org.apache.airavata.gfac.core.task.Task;
@@ -75,7 +76,7 @@ public class DataStageTask implements Task {
 							.getPath());
 				}
 				status.setReason("Successfully staged data");
-			} catch (SSHApiException e) {
+			} catch (GFacException e) {
 				String msg = "Scp attempt failed";
 				log.error(msg, e);
 				status.setState(TaskState.FAILED);

http://git-wip-us.apache.org/repos/asf/airavata/blob/445e1495/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DataStreamingTask.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DataStreamingTask.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DataStreamingTask.java
index ebe3bab..d516cd9 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DataStreamingTask.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DataStreamingTask.java
@@ -76,7 +76,8 @@ public class DataStreamingTask implements Task {
                 if (processOutput != null) {
                     if (processOutput.isOutputStreaming()) {
                         // stream output periodically
-                        ComputationalResourceSchedulingModel resourceSchedule = taskContext.getParentProcessContext().getProcessModel().getProcessResourceSchedule();
+                        ComputationalResourceSchedulingModel resourceSchedule = taskContext.getParentProcessContext()
+                                .getProcessModel().getProcessResourceSchedule();
                         int wallTimeLimit = resourceSchedule.getWallTimeLimit();
                         if (wallTimeLimit > 10) {
                             int period = wallTimeLimit / 10;

http://git-wip-us.apache.org/repos/asf/airavata/blob/445e1495/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DefaultJobSubmissionTask.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DefaultJobSubmissionTask.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DefaultJobSubmissionTask.java
index ddb3297..b9dc02a 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DefaultJobSubmissionTask.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/DefaultJobSubmissionTask.java
@@ -41,7 +41,6 @@ import org.apache.airavata.model.status.*;
 import org.apache.airavata.model.task.TaskTypes;
 import org.apache.airavata.registry.cpi.AppCatalogException;
 import org.apache.airavata.registry.cpi.ExperimentCatalogModelType;
-import org.apache.airavata.registry.cpi.RegistryException;
 import org.apache.commons.io.FileUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -239,7 +238,7 @@ public class DefaultJobSubmissionTask implements JobSubmissionTask {
 		    errorModel.setActualErrorMessage(e.getMessage());
 		    errorModel.setUserFriendlyMessage(msg);
 		    taskContext.getTaskModel().setTaskErrors(Arrays.asList(errorModel));
-	    } catch (ApplicationSettingsException | GFacException e) {
+	    } catch (ApplicationSettingsException e) {
 		    String msg = "Error occurred while creating job descriptor";
 		    log.error(msg, e);
 		    taskStatus.setState(TaskState.FAILED);
@@ -249,7 +248,7 @@ public class DefaultJobSubmissionTask implements JobSubmissionTask {
 		    errorModel.setActualErrorMessage(e.getMessage());
 		    errorModel.setUserFriendlyMessage(msg);
 		    taskContext.getTaskModel().setTaskErrors(Arrays.asList(errorModel));
-	    } catch (SSHApiException e) {
+	    } catch (GFacException e) {
 		    String msg = "Error occurred while submitting the job";
 		    log.error(msg, e);
 		    taskStatus.setState(TaskState.FAILED);
@@ -300,7 +299,7 @@ public class DefaultJobSubmissionTask implements JobSubmissionTask {
 	    return taskStatus;
     }
 
-    private boolean verifyJobSubmissionByJobId(RemoteCluster remoteCluster, String jobID)
throws SSHApiException {
+    private boolean verifyJobSubmissionByJobId(RemoteCluster remoteCluster, String jobID)
throws GFacException {
         JobStatus status = remoteCluster.getJobStatus(jobID);
         return status != null &&  status.getJobState() != JobState.UNKNOWN;
     }
@@ -310,7 +309,7 @@ public class DefaultJobSubmissionTask implements JobSubmissionTask {
         String jobId = null;
         try {
             jobId  = remoteCluster.getJobIdByJobName(jobName, remoteCluster.getServerInfo().getUserName());
-        } catch (SSHApiException e) {
+        } catch (GFacException e) {
             log.error("Error while verifying JobId from JobName");
         }
         return jobId;
@@ -367,7 +366,7 @@ public class DefaultJobSubmissionTask implements JobSubmissionTask {
 					throw new TaskException("Cancel operation failed, Job status couldn't find in resource,
JobId " +
 							jobModel.getJobId());
 				}
-			} catch (SSHApiException | InterruptedException e) {
+			} catch ( GFacException | InterruptedException e) {
 				throw new TaskException("Error while cancelling job " + jobModel.getJobId(), e);
 			}
 		} else {

http://git-wip-us.apache.org/repos/asf/airavata/blob/445e1495/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/EnvironmentSetupTask.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/EnvironmentSetupTask.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/EnvironmentSetupTask.java
index 7de0282..ff433a9 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/EnvironmentSetupTask.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/EnvironmentSetupTask.java
@@ -20,6 +20,7 @@
  */
 package org.apache.airavata.gfac.impl.task;
 
+import org.apache.airavata.gfac.core.GFacException;
 import org.apache.airavata.gfac.core.SSHApiException;
 import org.apache.airavata.gfac.core.cluster.RemoteCluster;
 import org.apache.airavata.gfac.core.context.TaskContext;
@@ -50,7 +51,7 @@ public class EnvironmentSetupTask implements Task {
 			RemoteCluster remoteCluster = taskContext.getParentProcessContext().getJobSubmissionRemoteCluster();
 			remoteCluster.makeDirectory(taskContext.getParentProcessContext().getWorkingDir());
 			status.setReason("Successfully created environment");
-		} catch (SSHApiException e) {
+		} catch (GFacException e) {
 			String msg = "Error while environment setup";
 			log.error(msg, e);
 			status.setState(TaskState.FAILED);

http://git-wip-us.apache.org/repos/asf/airavata/blob/445e1495/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/ForkJobSubmissionTask.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/ForkJobSubmissionTask.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/ForkJobSubmissionTask.java
index 1b43116..6a6a8c0 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/ForkJobSubmissionTask.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/ForkJobSubmissionTask.java
@@ -136,15 +136,6 @@ public class ForkJobSubmissionTask implements JobSubmissionTask {
             errorModel.setUserFriendlyMessage(msg);
             taskContext.getTaskModel().setTaskErrors(Arrays.asList(errorModel));
         } catch (GFacException e) {
-            String msg = "Error occurred while creating job descriptor";
-            log.error(msg, e);
-            taskStatus.setState(TaskState.FAILED);
-            taskStatus.setReason(msg);
-            ErrorModel errorModel = new ErrorModel();
-            errorModel.setActualErrorMessage(e.getMessage());
-            errorModel.setUserFriendlyMessage(msg);
-            taskContext.getTaskModel().setTaskErrors(Arrays.asList(errorModel));
-        } catch (SSHApiException e) {
             String msg = "Error occurred while submitting the job";
             log.error(msg, e);
             taskStatus.setState(TaskState.FAILED);

http://git-wip-us.apache.org/repos/asf/airavata/blob/445e1495/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/LocalJobSubmissionTask.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/LocalJobSubmissionTask.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/LocalJobSubmissionTask.java
index 7e989e4..aa2cbbd 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/LocalJobSubmissionTask.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/LocalJobSubmissionTask.java
@@ -129,7 +129,7 @@ public class LocalJobSubmissionTask implements JobSubmissionTask{
                 }
             }
 
-        } catch (GFacException | IOException | AppCatalogException | ApplicationSettingsException
| SSHApiException e) {
+        } catch (GFacException | IOException | AppCatalogException | ApplicationSettingsException
e) {
             String msg = "Error occurred while submitting a local job";
             log.error(msg, e);
             taskStatus.setReason(msg);

http://git-wip-us.apache.org/repos/asf/airavata/blob/445e1495/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/SCPDataStageTask.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/SCPDataStageTask.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/SCPDataStageTask.java
index 6a8800e..87bcbc1 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/SCPDataStageTask.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/SCPDataStageTask.java
@@ -32,6 +32,7 @@ import org.apache.airavata.gfac.core.cluster.CommandInfo;
 import org.apache.airavata.gfac.core.cluster.RawCommandInfo;
 import org.apache.airavata.gfac.core.cluster.RemoteCluster;
 import org.apache.airavata.gfac.core.cluster.ServerInfo;
+import org.apache.airavata.gfac.core.context.ProcessContext;
 import org.apache.airavata.gfac.core.context.TaskContext;
 import org.apache.airavata.gfac.core.task.Task;
 import org.apache.airavata.gfac.core.task.TaskException;
@@ -66,7 +67,6 @@ import java.util.Map;
 public class SCPDataStageTask implements Task {
     private static final Logger log = LoggerFactory.getLogger(SCPDataStageTask.class);
     private static final int DEFAULT_SSH_PORT = 22;
-    private String userName;
     private String hostName;
     private String inputPath;
 
@@ -81,7 +81,9 @@ public class SCPDataStageTask implements Task {
         AuthenticationInfo authenticationInfo = null;
         DataStagingTaskModel subTaskModel = null;
         String localDataDir = null;
-        ProcessState processState = taskContext.getParentProcessContext().getProcessState();
+
+        ProcessContext processContext = taskContext.getParentProcessContext();
+        ProcessState processState = processContext.getProcessState();
         try {
             subTaskModel = ((DataStagingTaskModel) taskContext.getSubTaskModel());
             if (processState == ProcessState.OUTPUT_DATA_STAGING) {
@@ -119,22 +121,16 @@ public class SCPDataStageTask implements Task {
                 return status;
             }
 
-            StorageResourceDescription storageResource = taskContext.getParentProcessContext().getStorageResource();
-            StoragePreference storagePreference = taskContext.getParentProcessContext().getStoragePreference();
+            StorageResourceDescription storageResource = processContext.getStorageResource();
+//            StoragePreference storagePreference = taskContext.getParentProcessContext().getStoragePreference();
 
             if (storageResource != null) {
                 hostName = storageResource.getHostName();
             } else {
                 throw new SSHApiException("Storage Resource is null");
             }
-
-            if (storagePreference != null) {
-                userName = storagePreference.getLoginUserName();
-                inputPath = storagePreference.getFileSystemRootLocation();
-                inputPath = (inputPath.endsWith(File.separator) ? inputPath : inputPath +
File.separator);
-            } else {
-                throw new SSHApiException("Storage Preference is null");
-            }
+            inputPath  = processContext.getStorageFileSystemRootLocation();
+            inputPath = (inputPath.endsWith(File.separator) ? inputPath : inputPath + File.separator);
 
             // use rsync instead of scp if source and destination host and user name is same.
             URI sourceURI = new URI(subTaskModel.getSource());
@@ -156,10 +152,10 @@ public class SCPDataStageTask implements Task {
                 return status;
             }
 
-            authenticationInfo = Factory.getStorageSSHKeyAuthentication(taskContext.getParentProcessContext());
+            authenticationInfo = Factory.getStorageSSHKeyAuthentication(processContext);
             status = new TaskStatus(TaskState.COMPLETED);
 
-            ServerInfo serverInfo = new ServerInfo(userName, hostName, DEFAULT_SSH_PORT);
+            ServerInfo serverInfo = processContext.getStorageResourceServerInfo();
             Session sshSession = Factory.getSSHSession(authenticationInfo, serverInfo);
             if (processState == ProcessState.INPUT_DATA_STAGING) {
                 inputDataStaging(taskContext, sshSession, sourceURI, destinationURI);
@@ -240,7 +236,7 @@ public class SCPDataStageTask implements Task {
         return status;
     }
 
-    private void localDataCopy(TaskContext taskContext, URI sourceURI, URI destinationURI)
throws SSHApiException {
+    private void localDataCopy(TaskContext taskContext, URI sourceURI, URI destinationURI)
throws GFacException {
         StringBuilder sb = new StringBuilder("rsync -cr ");
         sb.append(sourceURI.getPath()).append(" ").append(destinationURI.getPath());
         CommandInfo commandInfo = new RawCommandInfo(sb.toString());
@@ -248,7 +244,7 @@ public class SCPDataStageTask implements Task {
     }
 
     private void inputDataStaging(TaskContext taskContext, Session sshSession, URI sourceURI,
URI
-            destinationURI) throws SSHApiException, IOException, JSchException {
+            destinationURI) throws GFacException, IOException, JSchException {
         /**
          * scp third party file transfer 'to' compute resource.
          */
@@ -257,7 +253,7 @@ public class SCPDataStageTask implements Task {
     }
 
     private void outputDataStaging(TaskContext taskContext, Session sshSession, URI sourceURI,
URI destinationURI)
-            throws SSHApiException, AiravataException, IOException, JSchException, GFacException
{
+            throws AiravataException, IOException, JSchException, GFacException {
 
         /**
          * scp third party file transfer 'from' comute resource.

http://git-wip-us.apache.org/repos/asf/airavata/blob/445e1495/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/TaskUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/TaskUtils.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/TaskUtils.java
index cfa2e52..64f17ed 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/TaskUtils.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/TaskUtils.java
@@ -44,7 +44,7 @@ public class TaskUtils {
             filePath = inputPath + taskContext.getParentProcessContext().getProcessId() +
File.separator + fileName;
         }
         //FIXME
-        return new URI("file", taskContext.getParentProcessContext().getStoragePreference().getLoginUserName(),
hostName, 22, filePath, null, null);
+        return new URI("file", taskContext.getParentProcessContext().getStorageResourceLoginUserName(),
hostName, 22, filePath, null, null);
 
     }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/445e1495/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/utils/StreamData.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/utils/StreamData.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/utils/StreamData.java
index 375e570..aaf3058 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/utils/StreamData.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/utils/StreamData.java
@@ -85,7 +85,7 @@ public class StreamData extends TimerTask  {
             log.error("expId: {}, processId:{}, taskId: {}:- Couldn't stage file {} , Erroneous
path specified",
                     taskContext.getExperimentId(), taskContext.getProcessId(), taskContext.getTaskId(),
                     taskContext.getProcessOutput().getName());
-        } catch (IllegalAccessException | InstantiationException | AiravataException | IOException
| JSchException | SSHApiException e) {
+        } catch (IllegalAccessException | InstantiationException | AiravataException | IOException
| JSchException  e) {
             log.error("expId: {}, processId:{}, taskId: {}:- Couldn't stage file {} , Error
occurred while streaming data",
                     taskContext.getExperimentId(), taskContext.getProcessId(), taskContext.getTaskId(),
                     taskContext.getProcessOutput().getName());
@@ -96,7 +96,10 @@ public class StreamData extends TimerTask  {
         }
     }
 
-    public void runOutputStaging() throws URISyntaxException, IllegalAccessException, InstantiationException,
CredentialStoreException, AiravataException, IOException, JSchException, SSHApiException {
+    public void runOutputStaging() throws URISyntaxException,
+            IllegalAccessException,
+            InstantiationException,
+            CredentialStoreException, AiravataException, IOException, JSchException {
         try {
 
             AuthenticationInfo authenticationInfo = null;
@@ -117,7 +120,7 @@ public class StreamData extends TimerTask  {
             }
             authenticationInfo = Factory.getStorageSSHKeyAuthentication(taskContext.getParentProcessContext());
 
-            ServerInfo serverInfo = new ServerInfo(userName, hostName, DEFAULT_SSH_PORT);
+            ServerInfo serverInfo = taskContext.getParentProcessContext().getStorageResourceServerInfo();
             Session sshSession = Factory.getSSHSession(authenticationInfo, serverInfo);
             String targetPath = destinationURI.getPath().substring(0, destinationURI.getPath().lastIndexOf('/'));
             SSHUtils.makeDirectory(targetPath, sshSession);
@@ -130,7 +133,7 @@ public class StreamData extends TimerTask  {
         }
     }
 
-    private void localDataCopy(TaskContext taskContext, URI sourceURI, URI destinationURI)
throws SSHApiException {
+    private void localDataCopy(TaskContext taskContext, URI sourceURI, URI destinationURI)
throws GFacException {
         StringBuilder sb = new StringBuilder("rsync -cr ");
         sb.append(sourceURI.getPath()).append(" ").append(destinationURI.getPath());
         CommandInfo commandInfo = new RawCommandInfo(sb.toString());
@@ -146,7 +149,7 @@ public class StreamData extends TimerTask  {
     }
 
     private void outputDataStaging(TaskContext taskContext, Session sshSession, URI sourceURI,
URI destinationURI)
-            throws SSHApiException, AiravataException, IOException, JSchException, GFacException
{
+            throws AiravataException, IOException, JSchException, GFacException {
 
         /**
          * scp third party file transfer 'from' comute resource.

http://git-wip-us.apache.org/repos/asf/airavata/blob/445e1495/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/utils/bes/UNICORESecurityContext.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/utils/bes/UNICORESecurityContext.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/utils/bes/UNICORESecurityContext.java
index 609e1fa..7d05813 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/utils/bes/UNICORESecurityContext.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/utils/bes/UNICORESecurityContext.java
@@ -69,9 +69,11 @@ public class UNICORESecurityContext extends X509SecurityContext {
 		return secProperties;
 	}
 
-	public DefaultClientConfiguration getDefaultConfiguration(Boolean enableMessageLogging,
UserConfigurationDataModel userDataModel) throws GFacException, ApplicationSettingsException
{
+	public DefaultClientConfiguration getDefaultConfiguration(Boolean enableMessageLogging,
+															  UserConfigurationDataModel userDataModel)
+			throws GFacException, ApplicationSettingsException {
+
 		X509Credential cred = null;
-		
 		try{
 			boolean genCert = userDataModel.isGenerateCert();
 				if(genCert) {
@@ -89,7 +91,8 @@ public class UNICORESecurityContext extends X509SecurityContext {
 							
 							if(caCertPath.equals("") || caKeyPath.equals("")) {
 								throw new Exception("CA certificate or key file path missing in the properties file.
"
-										            + "Please make sure "+BESConstants.PROP_CA_CERT_PATH+ " or "+BESConstants.PROP_CA_KEY_PATH+"
are not empty.");
+										+ "Please make sure " + BESConstants.PROP_CA_CERT_PATH + " or "
+										+ BESConstants.PROP_CA_KEY_PATH + " are not empty.");
 							}
 							
 							if("".equals(caKeyPass)) {
@@ -114,7 +117,8 @@ public class UNICORESecurityContext extends X509SecurityContext {
 		secProperties.getETDSettings().setExtendTrustDelegation(true);
 		if(enableMessageLogging) secProperties.setMessageLogging(true);
 //		secProperties.setDoSignMessage(true);
-		secProperties.getETDSettings().setIssuerCertificateChain(secProperties.getCredential().getCertificateChain());
+		secProperties.getETDSettings()
+				.setIssuerCertificateChain(secProperties.getCredential().getCertificateChain());
 		
 		return secProperties;
 	}


Mime
View raw message