You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@giraph.apache.org by ma...@apache.org on 2017/09/07 23:49:54 UTC

git commit: updated refs/heads/trunk to 448ae1c

Repository: giraph
Updated Branches:
  refs/heads/trunk fc996e753 -> 448ae1c06


JIRA-1157

closes #46


Project: http://git-wip-us.apache.org/repos/asf/giraph/repo
Commit: http://git-wip-us.apache.org/repos/asf/giraph/commit/448ae1c0
Tree: http://git-wip-us.apache.org/repos/asf/giraph/tree/448ae1c0
Diff: http://git-wip-us.apache.org/repos/asf/giraph/diff/448ae1c0

Branch: refs/heads/trunk
Commit: 448ae1c06150d4fd62939b5a31f38c03d9a33c7c
Parents: fc996e7
Author: Maja Kabiljo <ma...@fb.com>
Authored: Thu Sep 7 16:49:44 2017 -0700
Committer: Maja Kabiljo <ma...@fb.com>
Committed: Thu Sep 7 16:49:44 2017 -0700

----------------------------------------------------------------------
 .../job/DefaultJobProgressTrackerService.java   | 27 +++++++++-----------
 1 file changed, 12 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/giraph/blob/448ae1c0/giraph-core/src/main/java/org/apache/giraph/job/DefaultJobProgressTrackerService.java
----------------------------------------------------------------------
diff --git a/giraph-core/src/main/java/org/apache/giraph/job/DefaultJobProgressTrackerService.java b/giraph-core/src/main/java/org/apache/giraph/job/DefaultJobProgressTrackerService.java
index 16eae1d..bef25df 100644
--- a/giraph-core/src/main/java/org/apache/giraph/job/DefaultJobProgressTrackerService.java
+++ b/giraph-core/src/main/java/org/apache/giraph/job/DefaultJobProgressTrackerService.java
@@ -113,7 +113,10 @@ public class DefaultJobProgressTrackerService
               lastTimeProgressChanged = System.currentTimeMillis();
             } else if (lastTimeProgressChanged +
                 maxAllowedTimeWithoutProgress < System.currentTimeMillis()) {
-              killTooLongJob();
+              // Job didn't make progress in too long, killing it
+              killJobWithMessage(
+                  "Killing the job because it didn't make progress for " +
+                      maxAllowedTimeWithoutProgress / 1000 + "s");
               break;
             }
           }
@@ -126,17 +129,16 @@ public class DefaultJobProgressTrackerService
   }
 
   /**
-   * Kill the job which was taking too long to make any progress
+   * Kill job with message describing why it's being killed
+   *
+   * @param message Message describing why job is being killed
    */
-  protected void killTooLongJob() {
-    // Job didn't make progress in too long, killing it
+  protected void killJobWithMessage(String message) {
+    LOG.error(message);
     try {
-      LOG.error("Killing the job because it didn't make progress for " +
-          MAX_ALLOWED_TIME_WITHOUT_PROGRESS_MS.get(conf) / 1000 + "s");
       job.killJob();
     } catch (IOException e) {
-      LOG.error(
-          "Failed to kill the job which wasn't making progress", e);
+      LOG.error("Failed to kill the job", e);
     }
   }
 
@@ -159,13 +161,8 @@ public class DefaultJobProgressTrackerService
         @Override
         public void run() {
           if (ThreadUtils.trySleep(maxAllowedJobTimeMs)) {
-            try {
-              LOG.warn("Killing job because it took longer than " +
-                  maxAllowedJobTimeMs + " milliseconds");
-              job.killJob();
-            } catch (IOException e) {
-              LOG.warn("Failed to kill job", e);
-            }
+            killJobWithMessage("Killing the job because it took longer than " +
+                maxAllowedJobTimeMs + " milliseconds");
           }
         }
       }, "job-runtime-observer");