airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject airavata git commit: Refactored Archive Task
Date Fri, 11 Mar 2016 20:43:14 GMT
Repository: airavata
Updated Branches:
  refs/heads/develop f7ea977d2 -> 4a04fab74


Refactored Archive Task


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

Branch: refs/heads/develop
Commit: 4a04fab74f2e3006c2cc36f1d88f243159dd3641
Parents: f7ea977
Author: Shameera Rathnayaka <shameerainfo@gmail.com>
Authored: Fri Mar 11 15:43:07 2016 -0500
Committer: Shameera Rathnayaka <shameerainfo@gmail.com>
Committed: Fri Mar 11 15:43:07 2016 -0500

----------------------------------------------------------------------
 .../apache/airavata/gfac/impl/task/ArchiveTask.java | 16 +++++++++-------
 .../cpi/impl/SimpleOrchestratorImpl.java            |  4 ++--
 2 files changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/4a04fab7/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 ef1708b..ae44997 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
@@ -121,24 +121,26 @@ public class ArchiveTask implements Task {
             workingDirName = path.substring(path.lastIndexOf(File.separator) + 1, path.length());
             // tar working dir
             // cd /Users/syodage/Desktop/temp/.. && tar -cvf path/workingDir.tar
temp
-            String archiveTar = workingDirName + ".tar";
-            CommandInfo commandInfo = new RawCommandInfo("cd " + path + "/.. && tar
-cvf "
-                    + path + "/" + archiveTar + " " + workingDirName);
+            String archiveTar =  "archive.tar";
+            String resourceAbsTarFilePath  = path + "/" + archiveTar;
+            CommandInfo commandInfo = new RawCommandInfo("cd " + path + " && tar
-cvf "
+                    + resourceAbsTarFilePath + " ./* ");
 
             // move tar to storage resource
-            path += "/" + archiveTar;
             remoteCluster.execute(commandInfo);
             destinationURI = getDestinationURI(taskContext, archiveTar);
-            remoteCluster.scpThirdParty(path ,destinationURI.getPath() , sshSession, RemoteCluster.DIRECTION.FROM,
true);
+            remoteCluster.scpThirdParty(resourceAbsTarFilePath ,destinationURI.getPath()
, sshSession, RemoteCluster.DIRECTION.FROM, true);
 
             // delete tar in remote computer resource
-            commandInfo = new RawCommandInfo("rm " + path + "/" + archiveTar);
+            commandInfo = new RawCommandInfo("rm " + resourceAbsTarFilePath);
             remoteCluster.execute(commandInfo);
 
             // untar file and delete tar in storage resource
             String destPath = destinationURI.getPath();
             String destParent = destPath.substring(0, destPath.lastIndexOf("/"));
-            commandInfo = new RawCommandInfo("cd " + destParent + " && tar -xvf "
+ archiveTar + " && rm " + archiveTar);
+            String storageArchiveDir = "ARCHIVE";
+            commandInfo = new RawCommandInfo("cd " + destParent + " && mkdir " +
storageArchiveDir +
+                    " && tar -xvf " + archiveTar + " -C " + storageArchiveDir + "
&& rm " + archiveTar);
             executeCommand(sshSession, commandInfo, new StandardOutReader());
         } catch (GFacException | AiravataException | URISyntaxException | SSHApiException
e) {
             String msg = "Error! Archive task failed";

http://git-wip-us.apache.org/repos/asf/airavata/blob/4a04fab7/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
index ca7be48..559f007 100644
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
@@ -572,8 +572,8 @@ public class SimpleOrchestratorImpl extends AbstractOrchestrator{
             ComputeResourcePreference computeResourcePreference = OrchestratorUtils.getComputeResourcePreference(orchestratorContext,
processModel, gatewayId);
             ComputeResourceDescription computeResource = orchestratorContext.getRegistry().getAppCatalog().getComputeResource().getComputeResource(processModel.getComputeResourceId());
 
-            String remoteOutputDir = computeResourcePreference.getScratchLocation() + File.separator
+ processModel.getProcessId();
-            remoteOutputDir = remoteOutputDir.endsWith("/") ? remoteOutputDir : remoteOutputDir
+ "/";
+            String remoteOutputDir = computeResourcePreference.getScratchLocation(); // TODO
check tail '/' in scratch path
+            remoteOutputDir = remoteOutputDir.endsWith("/") ? remoteOutputDir + processModel.getProcessId()
: remoteOutputDir + "/" + processModel.getProcessId();
             DataStagingTaskModel submodel = new DataStagingTaskModel();
             DataMovementProtocol dataMovementProtocol = OrchestratorUtils.getPreferredDataMovementProtocol(orchestratorContext,
processModel, gatewayId);
             URI source = null;


Mime
View raw message