Return-Path: X-Original-To: apmail-airavata-commits-archive@www.apache.org Delivered-To: apmail-airavata-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CD567105EE for ; Thu, 29 May 2014 00:28:39 +0000 (UTC) Received: (qmail 51764 invoked by uid 500); 29 May 2014 00:28:39 -0000 Delivered-To: apmail-airavata-commits-archive@airavata.apache.org Received: (qmail 51723 invoked by uid 500); 29 May 2014 00:28:39 -0000 Mailing-List: contact commits-help@airavata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airavata.apache.org Delivered-To: mailing list commits@airavata.apache.org Received: (qmail 51716 invoked by uid 99); 29 May 2014 00:28:39 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 May 2014 00:28:39 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 82F1F4EB89; Thu, 29 May 2014 00:28:39 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: raminder@apache.org To: commits@airavata.apache.org Message-Id: <24d6a103be364969b10300393f98c141@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: Fixed output movement and output location updating. AIRAVATA-1284 Date: Thu, 29 May 2014 00:28:39 +0000 (UTC) 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 Authored: Wed May 28 20:28:01 2014 -0400 Committer: raminder 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 stringActualParameterMap = OutputUtils.fillOutputFromStdout(output, stdOutStr, stdErrStr); Set 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 outputArray = new ArrayList(); + //FIXME: this will not work for if all the parameters are not URI + Map output = jobExecutionContext.getOutMessageContext().getParameters(); + List list = new ArrayList(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); } }