hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edwardy...@apache.org
Subject svn commit: r1411989 - /hama/trunk/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java
Date Wed, 21 Nov 2012 05:57:36 GMT
Author: edwardyoon
Date: Wed Nov 21 05:57:36 2012
New Revision: 1411989

URL: http://svn.apache.org/viewvc?rev=1411989&view=rev
Log:
HAMA-665: Add graph job counter

Modified:
    hama/trunk/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java

Modified: hama/trunk/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java
URL: http://svn.apache.org/viewvc/hama/trunk/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java?rev=1411989&r1=1411988&r2=1411989&view=diff
==============================================================================
--- hama/trunk/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java (original)
+++ hama/trunk/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java Wed Nov 21 05:57:36
2012
@@ -53,6 +53,10 @@ import org.apache.hama.util.KeyValuePair
 public final class GraphJobRunner<V extends Writable, E extends Writable, M extends Writable>
     extends BSP<Writable, Writable, Writable, Writable, GraphJobMessage> {
 
+  public static enum GraphJobCounter {
+    MULTISTEP_PARTITIONING, ITERATIONS, INPUT_VERTICES, AGGREGATE_VERTICES
+  }
+
   private static final Log LOG = LogFactory.getLog(GraphJobRunner.class);
 
   // make sure that these values don't collide with the vertex names
@@ -124,7 +128,12 @@ public final class GraphJobRunner<V exte
       }
       // loop over vertices and do their computation
       doSuperstep(messages, peer);
+
+      if (isMasterTask(peer)) {
+        peer.getCounter(GraphJobCounter.ITERATIONS).increment(1);
+      }
     }
+
   }
 
   /**
@@ -304,10 +313,11 @@ public final class GraphJobRunner<V exte
         vertexFinished = reader.parseVertex(next.getKey(), next.getValue(),
             vertex);
       } catch (Exception e) {
-        //LOG.error("exception occured during parsing vertex!" + e.toString());
-        throw new IOException("exception occured during parsing vertex!" + e.toString());
+        // LOG.error("exception occured during parsing vertex!" + e.toString());
+        throw new IOException("exception occured during parsing vertex!"
+            + e.toString());
       }
-      
+
       if (!vertexFinished) {
         continue;
       }
@@ -525,7 +535,12 @@ public final class GraphJobRunner<V exte
     for (Entry<Writable, Writable> e : x.entrySet()) {
       multiSteps = ((IntWritable) e.getValue()).get();
     }
-    LOG.info(peer.getPeerName() + ": " + multiSteps);
+
+    if (isMasterTask(peer)) {
+      peer.getCounter(GraphJobCounter.MULTISTEP_PARTITIONING).increment(
+          multiSteps);
+    }
+
     return multiSteps;
   }
 
@@ -548,6 +563,10 @@ public final class GraphJobRunner<V exte
         numberVertices += msg.getVerticesSize().get();
       }
     }
+
+    if (isMasterTask(peer)) {
+      peer.getCounter(GraphJobCounter.INPUT_VERTICES).increment(numberVertices);
+    }
   }
 
   /**



Mime
View raw message