You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by di...@apache.org on 2022/01/05 00:49:19 UTC

[airavata] branch master updated: Optimizing the un-archiving process by separating out chain comands

This is an automated email from the ASF dual-hosted git repository.

dimuthuupe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata.git


The following commit(s) were added to refs/heads/master by this push:
     new acce953  Optimizing the un-archiving process by separating out chain comands
acce953 is described below

commit acce953c5500fb6759e443cdf1bf33b2d88250dd
Author: Dimuthu Wannipurage <di...@gmail.com>
AuthorDate: Tue Jan 4 19:46:23 2022 -0500

    Optimizing the un-archiving process by separating out chain comands
---
 .../helix/impl/task/staging/ArchiveTask.java         | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/staging/ArchiveTask.java b/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/staging/ArchiveTask.java
index a167852..5b93e31 100644
--- a/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/staging/ArchiveTask.java
+++ b/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/staging/ArchiveTask.java
@@ -110,15 +110,21 @@ public class ArchiveTask extends DataStagingTask {
 
                     String destParent = destFilePath.substring(0, destFilePath.lastIndexOf("/"));
                     final String storageArchiveDir = "ARCHIVE";
-                    String unArchiveTarCommand = "mkdir -p " + storageArchiveDir + " && tar -xvf " + archiveFileName + " -C "
-                            + storageArchiveDir + " && rm " + archiveFileName + " && chmod 755 -f -R " + storageArchiveDir + "/*";
-                    logger.info("Running Un archiving command on storage resource " + unArchiveTarCommand);
+                    String[] unarchiveCommands = {
+                            "mkdir -p " + storageArchiveDir,
+                            "tar -xvf " + archiveFileName + " -C " + storageArchiveDir,
+                            "rm " + archiveFileName,
+                            "chmod 755 -f -R " + storageArchiveDir + "/*"
+                    };
 
                     try {
-                        CommandOutput unTarCommandOutput = storageResourceAdaptor.executeCommand(unArchiveTarCommand, destParent);
-                        if (unTarCommandOutput.getExitCode() != 0) {
-                            throw new TaskOnFailException("Failed while running the untar command " + unTarCommandOutput + ". Sout : " +
-                                    unTarCommandOutput.getStdOut() + ". Serr " + unTarCommandOutput.getStdError(), false, null);
+                        for (String command : unarchiveCommands) {
+                            logger.info("Running command {} as a part of the un-archiving process", command);
+                            CommandOutput unTarCommandOutput = storageResourceAdaptor.executeCommand(command, destParent);
+                            if (unTarCommandOutput.getExitCode() != 0) {
+                                throw new TaskOnFailException("Failed while running the un-archiving command " + command + ". Sout : " +
+                                        unTarCommandOutput.getStdOut() + ". Serr : " + unTarCommandOutput.getStdError(), false, null);
+                            }
                         }
                     } catch (AgentException e) {
                         throw new TaskOnFailException("Failed while running the untar command " + tarringCommand, false, null);