Repository: airavata
Updated Branches:
  refs/heads/master fdcf2c96a -> 1fbef2110


Fixed output data staging issues.


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/1fbef211
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/1fbef211
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/1fbef211

Branch: refs/heads/master
Commit: 1fbef2110d1028481d66103fe4e5d76fd4062a03
Parents: fdcf2c9
Author: Shameera Rathanyaka <[email protected]>
Authored: Wed Aug 26 16:15:44 2015 -0400
Committer: Shameera Rathanyaka <[email protected]>
Committed: Wed Aug 26 16:15:44 2015 -0400

----------------------------------------------------------------------
 .../gfac/impl/task/AdvancedSCPDataStageTask.java  | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/1fbef211/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/AdvancedSCPDataStageTask.java
----------------------------------------------------------------------
diff --git 
a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/AdvancedSCPDataStageTask.java
 
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/AdvancedSCPDataStageTask.java
index 1f05941..9210c93 100644
--- 
a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/AdvancedSCPDataStageTask.java
+++ 
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/AdvancedSCPDataStageTask.java
@@ -100,7 +100,6 @@ public class AdvancedSCPDataStageTask implements Task{
             subTaskModel = (DataStagingTaskModel) ThriftUtils.getSubTaskModel
                     (taskContext.getTaskModel());
             URI sourceURI = new URI(subTaskModel.getSource());
-            URI destinationURI = new URI(subTaskModel.getDestination());
 
             File templocalDataDir = getLocalDataDir(taskContext);
             if (!templocalDataDir.exists()) {
@@ -116,13 +115,22 @@ public class AdvancedSCPDataStageTask implements Task{
             ServerInfo serverInfo = new ServerInfo(userName, hostName, 
DEFAULT_SSH_PORT);
             Session sshSession = Factory.getSSHSession(authenticationInfo, 
serverInfo);
             ProcessState processState = 
taskContext.getParentProcessContext().getProcessState();
-            if (processState == ProcessState.INPUT_DATA_STAGING) {
+               URI destinationURI = null;
+               if (processState == ProcessState.INPUT_DATA_STAGING) {
+                       destinationURI = new URI(subTaskModel.getDestination());
                 inputDataStaging(taskContext, sshSession, sourceURI, 
destinationURI, filePath);
                 status.setReason("Successfully staged input data");
             }else if (processState == ProcessState.OUTPUT_DATA_STAGING) {
-                outputDataStaging(taskContext, sshSession, sourceURI, 
destinationURI, filePath);
-                status.setReason("Successfully staged output data");
-            } else {
+                       String targetPath = (inputPath.endsWith(File.separator) 
? inputPath : inputPath + File.separator) +
+                                       
taskContext.getParentProcessContext().getProcessId();
+                       SSHUtils.makeDirectory(targetPath, sshSession);
+                       String targetFilePath =  targetPath + File.separator + 
fileName;
+                       destinationURI = new URI("SCP", hostName, 
targetFilePath, null);
+                       subTaskModel.setDestination(destinationURI.getPath());
+                       // TODO - save updated subtask model with new 
destination
+                       outputDataStaging(taskContext, sshSession, sourceURI, 
destinationURI, filePath);
+                       status.setReason("Successfully staged output data");
+               } else {
                 status.setState(TaskState.FAILED);
                 status.setReason("Invalid task invocation, Support " + 
ProcessState.INPUT_DATA_STAGING.name() + " and " +
                         "" + ProcessState.OUTPUT_DATA_STAGING.name() + " 
process phases. found " + processState.name());

Reply via email to