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 2019/06/02 21:06:14 UTC

[airavata] branch master updated: Retrying for files to appear in filesystem if they are not found in first time

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 edd4246  Retrying for files to appear in filesystem if they are not found in first time
edd4246 is described below

commit edd4246e4ebef13df643c1dc21af0c442d62ab0f
Author: Dimuthu Wannipurage <di...@gmail.com>
AuthorDate: Sun Jun 2 17:06:02 2019 -0400

    Retrying for files to appear in filesystem if they are not found in first time
---
 .../helix/impl/task/staging/DataStagingTask.java         | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/staging/DataStagingTask.java b/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/staging/DataStagingTask.java
index b2c94d6..b4a0ea8 100644
--- a/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/staging/DataStagingTask.java
+++ b/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/staging/DataStagingTask.java
@@ -139,6 +139,22 @@ public abstract class DataStagingTask extends AiravataTask {
 
         try {
             boolean fileExists = adaptor.doesFileExist(sourcePath);
+
+            if (!fileExists) {
+                for (int i = 1; i <= 3; i++) {
+                    logger.warn("File " + sourcePath + " was not found in path. Retrying in 10 seconds. Try " + i);
+                    try {
+                        Thread.sleep(10 * 1000);
+                    } catch (InterruptedException e) {
+                        logger.error("Unexpected error in waiting", e);
+                    }
+                    fileExists = adaptor.doesFileExist(sourcePath);
+                    if (fileExists) {
+                        break;
+                    }
+                }
+            }
+
             if (!fileExists) {
                 logger.warn("Ignoring the file " + sourcePath + " transfer as it is not available");
                 return false;