Skip to content
Permalink
Browse files
JIRA-1166
closes #55
  • Loading branch information
Maja Kabiljo committed Jan 10, 2018
1 parent dc500a7 commit 8e2df4f8cff43e2fd7f7eda1b9f73cd093008c3e
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 1 deletion.
@@ -984,6 +984,9 @@ private GlobalStats aggregateWorkerStats(long superstep) {
} else {
printAggregatedMetricsToHDFS(superstep, aggregatedMetrics);
}
for (MasterObserver observer : observers) {
observer.superstepMetricsUpdate(superstep, aggregatedMetrics);
}
}

if (LOG.isInfoEnabled()) {
@@ -19,6 +19,7 @@
package org.apache.giraph.master;

import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
import org.apache.giraph.metrics.AggregatedMetrics;

/**
* A no-op implementation of MasterObserver to make it easier for users.
@@ -51,4 +52,8 @@ public void preSuperstep(long superstep) { }

@Override
public void postSuperstep(long superstep) { }

@Override
public void superstepMetricsUpdate(long superstep,
AggregatedMetrics aggregatedMetrics) { }
}
@@ -19,6 +19,7 @@
package org.apache.giraph.master;

import org.apache.giraph.conf.ImmutableClassesGiraphConfigurable;
import org.apache.giraph.metrics.AggregatedMetrics;

/**
* Observer for Master.
@@ -55,4 +56,13 @@ public interface MasterObserver extends ImmutableClassesGiraphConfigurable {
* @param superstep The superstep number
*/
void postSuperstep(long superstep);

/**
* Called after each superstep with aggregated metrics from workers
*
* @param superstep Supsertep number
* @param aggregatedMetrics Metrics
*/
void superstepMetricsUpdate(
long superstep, AggregatedMetrics aggregatedMetrics);
}
@@ -23,7 +23,7 @@
*
* @param <T> types of value (either long or double)
*/
class ValueWithHostname<T extends Number> {
public class ValueWithHostname<T extends Number> {
/** long value we're holding */
private T value;
/** host associated with value */
@@ -21,6 +21,7 @@
import org.apache.giraph.conf.GiraphConstants;
import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
import org.apache.giraph.master.MasterObserver;
import org.apache.giraph.metrics.AggregatedMetrics;
import org.apache.giraph.worker.WorkerObserver;
import org.apache.log4j.Logger;

@@ -99,6 +100,10 @@ public void preSuperstep(long superstep) { }
@Override
public void postSuperstep(long superstep) { }

@Override
public void superstepMetricsUpdate(long superstep,
AggregatedMetrics aggregatedMetrics) { }

@Override
public void applicationFailed(Exception e) { }

@@ -19,6 +19,7 @@

import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
import org.apache.giraph.master.MasterObserver;
import org.apache.giraph.metrics.AggregatedMetrics;
import org.apache.giraph.worker.WorkerObserver;

/**
@@ -55,4 +56,8 @@ public void preSuperstep(long superstep) { }

@Override
public void postSuperstep(long superstep) { }

@Override
public void superstepMetricsUpdate(long superstep,
AggregatedMetrics aggregatedMetrics) { }
}
@@ -22,6 +22,7 @@
import org.apache.giraph.conf.GiraphConstants;
import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
import org.apache.giraph.master.MasterObserver;
import org.apache.giraph.metrics.AggregatedMetrics;
import org.apache.giraph.worker.WorkerObserver;
import org.apache.log4j.Logger;

@@ -110,6 +111,10 @@ public void preSuperstep(long superstep) { }
@Override
public void postSuperstep(long superstep) { }

@Override
public void superstepMetricsUpdate(long superstep,
AggregatedMetrics aggregatedMetrics) { }

@Override
public void applicationFailed(Exception e) { }

0 comments on commit 8e2df4f

Please sign in to comment.