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 2018/10/04 17:47:14 UTC
[airavata] branch staging updated: Fixing the bug of second retry
count being 1
This is an automated email from the ASF dual-hosted git repository.
dimuthuupe pushed a commit to branch staging
in repository https://gitbox.apache.org/repos/asf/airavata.git
The following commit(s) were added to refs/heads/staging by this push:
new 353e64b Fixing the bug of second retry count being 1
353e64b is described below
commit 353e64bc91ed7a5eef559d7af04b8f8724bdd64e
Author: Dimuthu Wannipurage <di...@datasprouts.com>
AuthorDate: Thu Oct 4 13:46:53 2018 -0400
Fixing the bug of second retry count being 1
---
.../java/org/apache/airavata/helix/impl/task/AiravataTask.java | 2 +-
.../src/main/java/org/apache/airavata/helix/core/AbstractTask.java | 4 ++--
.../java/org/apache/airavata/helix/core/util/MonitoringUtil.java | 7 ++-----
3 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/AiravataTask.java b/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/AiravataTask.java
index fdc7526..56565f2 100644
--- a/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/AiravataTask.java
+++ b/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/task/AiravataTask.java
@@ -111,7 +111,7 @@ public abstract class AiravataTask extends AbstractTask {
if (currentRetryCount < getRetryCount() && !fatal) {
try {
- markNewRetry();
+ markNewRetry(currentRetryCount);
} catch (Exception e) {
logger.error("Failed to mark retry. So failing the task permanently", e);
fatal = true;
diff --git a/modules/airavata-helix/task-core/src/main/java/org/apache/airavata/helix/core/AbstractTask.java b/modules/airavata-helix/task-core/src/main/java/org/apache/airavata/helix/core/AbstractTask.java
index 6da7edf..2292d0f 100644
--- a/modules/airavata-helix/task-core/src/main/java/org/apache/airavata/helix/core/AbstractTask.java
+++ b/modules/airavata-helix/task-core/src/main/java/org/apache/airavata/helix/core/AbstractTask.java
@@ -180,8 +180,8 @@ public abstract class AbstractTask extends UserContentStore implements Task {
return MonitoringUtil.getTaskRetryCount(getCuratorClient(), taskId);
}
- protected void markNewRetry() throws Exception {
- MonitoringUtil.increaseTaskRetryCount(getCuratorClient(), taskId);
+ protected void markNewRetry(int currentRetryCount) throws Exception {
+ MonitoringUtil.increaseTaskRetryCount(getCuratorClient(), taskId, currentRetryCount);
}
public int getRetryCount() {
diff --git a/modules/airavata-helix/task-core/src/main/java/org/apache/airavata/helix/core/util/MonitoringUtil.java b/modules/airavata-helix/task-core/src/main/java/org/apache/airavata/helix/core/util/MonitoringUtil.java
index b1e3a70..f9a0418 100644
--- a/modules/airavata-helix/task-core/src/main/java/org/apache/airavata/helix/core/util/MonitoringUtil.java
+++ b/modules/airavata-helix/task-core/src/main/java/org/apache/airavata/helix/core/util/MonitoringUtil.java
@@ -81,16 +81,13 @@ public class MonitoringUtil {
}
}
- public static void increaseTaskRetryCount(CuratorFramework curatorClient, String takId) throws Exception {
+ public static void increaseTaskRetryCount(CuratorFramework curatorClient, String takId, int currentRetryCount) throws Exception {
String path = TASK + "/" + takId + RETRY;
- int currentRetryCount = 1;
if (curatorClient.checkExists().forPath(path) != null) {
- byte[] processBytes = curatorClient.getData().forPath(path);
- currentRetryCount = Integer.parseInt(new String(processBytes)) + 1;
curatorClient.delete().forPath(path);
}
curatorClient.create().creatingParentsIfNeeded().withMode(CreateMode.PERSISTENT).forPath(
- path , (currentRetryCount + "").getBytes());
+ path , ((currentRetryCount + 1) + "").getBytes());
}
public static String getExperimentIdByJobId(CuratorFramework curatorClient, String jobId) throws Exception {