airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramin...@apache.org
Subject git commit: Fixed output movement and output location updating. AIRAVATA-1284
Date Thu, 29 May 2014 00:28:39 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 79ea2f164 -> e3b0bf2bf


Fixed output movement and output location updating. AIRAVATA-1284

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

Branch: refs/heads/master
Commit: e3b0bf2bf9d130d2a4dba700b5b551a8997de650
Parents: 79ea2f1
Author: raminder <raminder@apache.org>
Authored: Wed May 28 20:28:01 2014 -0400
Committer: raminder <raminder@apache.org>
Committed: Wed May 28 20:28:01 2014 -0400

----------------------------------------------------------------------
 .../gsissh/handler/GSISSHOutputHandler.java     | 13 ++++++++-
 .../ssh/handler/AdvancedSCPOutputHandler.java   | 29 ++++++++++++++++++--
 2 files changed, 38 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/e3b0bf2b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
index 048357f..f4872ce 100644
--- a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
+++ b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
@@ -169,10 +169,21 @@ public class GSISSHOutputHandler extends AbstractHandler {
                         OutputUtils.fillOutputFromStdout1(output, stdOutStr, stdErrStr, outputArray);
                         Map<String, ActualParameter> stringActualParameterMap = OutputUtils.fillOutputFromStdout(output,
stdOutStr, stdErrStr);
                         Set<String> strings = stringActualParameterMap.keySet();
+                        outputArray.clear();
                         for(String key:strings) {
                             ActualParameter actualParameter1 = stringActualParameterMap.get(key);
                             if("URI".equals(actualParameter1.getType().getType().toString())){
-                                jobExecutionContext.addOutputFile(MappingFactory.toString(actualParameter1));
+                            	String downloadFile = MappingFactory.toString(actualParameter1);
+                            	cluster.scpFrom(downloadFile, outputDataDir);
+                            	String fileName = downloadFile.substring(downloadFile.lastIndexOf(File.separatorChar)+1,
downloadFile.length());
+                            	String localFile = outputDataDir +  File.separator +fileName;
+								jobExecutionContext.addOutputFile(localFile);
+								
+                            	DataObjectType dataObjectType = new DataObjectType();
+                                dataObjectType.setValue(localFile);
+                                dataObjectType.setKey(key);
+                                dataObjectType.setType(DataType.URI);
+                                outputArray.add(dataObjectType);
                             }
                         }
                         break;

http://git-wip-us.apache.org/repos/asf/airavata/blob/e3b0bf2b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
index 1a8579d..936528b 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
@@ -21,6 +21,8 @@
 package org.apache.airavata.gfac.ssh.handler;
 
 import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.commons.gfac.type.ActualParameter;
+import org.apache.airavata.commons.gfac.type.MappingFactory;
 import org.apache.airavata.gfac.GFacException;
 import org.apache.airavata.gfac.core.context.JobExecutionContext;
 import org.apache.airavata.gfac.core.handler.AbstractHandler;
@@ -35,12 +37,19 @@ import org.apache.airavata.gsi.ssh.impl.PBSCluster;
 import org.apache.airavata.gsi.ssh.impl.authentication.DefaultPasswordAuthenticationInfo;
 import org.apache.airavata.gsi.ssh.impl.authentication.DefaultPublicKeyFileAuthentication;
 import org.apache.airavata.gsi.ssh.util.CommonUtils;
+import org.apache.airavata.model.workspace.experiment.DataObjectType;
+import org.apache.airavata.model.workspace.experiment.DataType;
+import org.apache.airavata.registry.cpi.ChildDataType;
 import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
 import java.util.Properties;
+import java.util.Set;
 
 /**
  * This handler will copy outputs from airavata installed local directory
@@ -99,8 +108,9 @@ public class AdvancedSCPOutputHandler extends AbstractHandler {
             String standardError = app.getStandardError();
             String standardOutput = app.getStandardOutput();
             String outputDataDirectory = app.getOutputDataDirectory();
-
+            super.invoke(jobExecutionContext);
             AuthenticationInfo authenticationInfo = null;
+            System.out.println("Testing");
             if (password != null) {
                 authenticationInfo = new DefaultPasswordAuthenticationInfo(this.password);
             } else {
@@ -116,14 +126,27 @@ public class AdvancedSCPOutputHandler extends AbstractHandler {
             pbsCluster.makeDirectory(outputPath);
             pbsCluster.scpTo(outputPath, standardError);
             pbsCluster.scpTo(outputPath, standardOutput);
+            List<DataObjectType> outputArray = new ArrayList<DataObjectType>();
+            //FIXME: this will not work for if all the parameters are not URI
+            Map<String, Object> output = jobExecutionContext.getOutMessageContext().getParameters();
+            List<String> list = new ArrayList<String>(output.keySet());
+            int i = 0;
             for (String files : jobExecutionContext.getOutputFiles()) {
-                pbsCluster.scpTo(outputPath, files);
+            	pbsCluster.scpTo(outputPath, files);
+                String fileName = files.substring(files.lastIndexOf(File.separatorChar)+1,
files.length());
+                DataObjectType dataObjectType = new DataObjectType();
+                dataObjectType.setValue(outputPath + File.separatorChar + fileName);
+                dataObjectType.setKey(list.get(i));
+                dataObjectType.setType(DataType.URI);
+                outputArray.add(dataObjectType);
+                i++;
             }
+            registry.add(ChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID());
         } catch (SSHApiException e) {
             log.error("Error transfering files to remote host : " + hostName + " with the
user: " + userName);
             log.error(e.getMessage());
             throw new GFacHandlerException(e);
-        } catch (GFacException e) {
+        } catch (Exception e) {
             throw new GFacHandlerException(e);
         }
     }


Mime
View raw message