Updated Branches:
  refs/heads/trunk 7cc54575d -> 13d84663b

GIRAPH-832: Test don't finish after GIRAPH-792 (majakabiljo)


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

Branch: refs/heads/trunk
Commit: 13d84663bc4eedb2e9e4035af75622b0a3cb480e
Parents: 7cc5457
Author: Maja Kabiljo <[email protected]>
Authored: Thu Jan 30 08:47:30 2014 -0800
Committer: Maja Kabiljo <[email protected]>
Committed: Thu Jan 30 08:48:15 2014 -0800

----------------------------------------------------------------------
 CHANGELOG                                       |  2 ++
 .../apache/giraph/graph/GraphTaskManager.java   | 24 ++++++++++++++++----
 .../giraph/worker/WorkerProgressWriter.java     |  3 ++-
 3 files changed, 24 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/giraph/blob/13d84663/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 971ab46..1c1be0b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,8 @@
 Giraph Change Log
 
 Release 1.1.0 - unreleased
+  GIRAPH-832: Test don't finish after GIRAPH-792 (majakabiljo)
+
   GIRAPH-792: Print job progress to command line (majakabiljo)
 
   GIRAPH-831: waitUntilAllTasksDone waits forever (without debug information) 
(aching)

http://git-wip-us.apache.org/repos/asf/giraph/blob/13d84663/giraph-core/src/main/java/org/apache/giraph/graph/GraphTaskManager.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/graph/GraphTaskManager.java 
b/giraph-core/src/main/java/org/apache/giraph/graph/GraphTaskManager.java
index a84ac66..064c71f 100644
--- a/giraph-core/src/main/java/org/apache/giraph/graph/GraphTaskManager.java
+++ b/giraph-core/src/main/java/org/apache/giraph/graph/GraphTaskManager.java
@@ -173,6 +173,19 @@ public class GraphTaskManager<I extends 
WritableComparable, V extends Writable,
   }
 
   /**
+   * In order for job client to know which ZooKeeper the job is using,
+   * we create a counter with server:port as its name inside of
+   * ZOOKEEPER_SERVER_PORT_COUNTER_GROUP.
+   *
+   * @param serverPortList Server:port list for ZooKeeper used
+   */
+  private void createZooKeeperCounter(String serverPortList) {
+    // Getting the counter will actually create it.
+    context.getCounter(GiraphConstants.ZOOKEEPER_SERVER_PORT_COUNTER_GROUP,
+        serverPortList);
+  }
+
+  /**
    * Called by owner of this GraphTaskManager on each compute node
    *
    * @param zkPathList the path to the ZK jars we need to run the job
@@ -200,8 +213,12 @@ public class GraphTaskManager<I extends 
WritableComparable, V extends Writable,
     context.setStatus("setup: Initializing Zookeeper services.");
     locateZookeeperClasspath(zkPathList);
     String serverPortList = conf.getZookeeperList();
-    if (serverPortList.isEmpty() && startZooKeeperManager()) {
-      return; // ZK connect/startup failed
+    if (serverPortList.isEmpty()) {
+      if (startZooKeeperManager()) {
+        return; // ZK connect/startup failed
+      }
+    } else {
+      createZooKeeperCounter(serverPortList);
     }
     if (zkManager != null && zkManager.runsZooKeeper()) {
       if (LOG.isInfoEnabled()) {
@@ -369,8 +386,7 @@ public class GraphTaskManager<I extends WritableComparable, 
V extends Writable,
     zkManager.onlineZooKeeperServers();
     String serverPortList = zkManager.getZooKeeperServerPortString();
     conf.setZookeeperList(serverPortList);
-    context.getCounter(GiraphConstants.ZOOKEEPER_SERVER_PORT_COUNTER_GROUP,
-        serverPortList);
+    createZooKeeperCounter(serverPortList);
     return false;
   }
 

http://git-wip-us.apache.org/repos/asf/giraph/blob/13d84663/giraph-core/src/main/java/org/apache/giraph/worker/WorkerProgressWriter.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/worker/WorkerProgressWriter.java 
b/giraph-core/src/main/java/org/apache/giraph/worker/WorkerProgressWriter.java
index f8c7571..81acc13 100644
--- 
a/giraph-core/src/main/java/org/apache/giraph/worker/WorkerProgressWriter.java
+++ 
b/giraph-core/src/main/java/org/apache/giraph/worker/WorkerProgressWriter.java
@@ -55,8 +55,9 @@ public class WorkerProgressWriter {
             Thread.sleep((long) (WRITE_UPDATE_PERIOD_MILLISECONDS * factor));
           }
         } catch (InterruptedException e) {
+          // Thread is interrupted when stop is called, we can just log this
           if (LOG.isInfoEnabled()) {
-            LOG.info("run: WorkerProgressWriter interrupted", e);
+            LOG.info("run: WorkerProgressWriter interrupted");
           }
         }
       }

Reply via email to