Skip to content

Commit 70472a2

Browse files
author
pgandhi
committed
[SPARK-18364] : Fixing Code to pass Unit tests
1 parent edd355e commit 70472a2

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleService.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -171,17 +171,6 @@ protected void serviceInit(Configuration conf) throws Exception {
171171
TransportConf transportConf = new TransportConf("shuffle", new HadoopConfigProvider(conf));
172172
blockHandler = new ExternalShuffleBlockHandler(transportConf, registeredExecutorFile);
173173

174-
// register metrics on the block handler into the Node Manager's metrics system.
175-
blockHandler.getAllMetrics().getMetrics().put("numRegisteredConnections",
176-
shuffleServer.getRegisteredConnections());
177-
YarnShuffleServiceMetrics serviceMetrics =
178-
new YarnShuffleServiceMetrics(blockHandler.getAllMetrics());
179-
180-
MetricsSystemImpl metricsSystem = (MetricsSystemImpl) DefaultMetricsSystem.instance();
181-
metricsSystem.register(
182-
"sparkShuffleService", "Metrics on the Spark Shuffle Service", serviceMetrics);
183-
logger.info("Registered metrics with Hadoop's DefaultMetricsSystem");
184-
185174
// If authentication is enabled, set up the shuffle server to use a
186175
// special RPC handler that filters out unauthenticated fetch requests
187176
List<TransportServerBootstrap> bootstraps = Lists.newArrayList();
@@ -202,6 +191,18 @@ protected void serviceInit(Configuration conf) throws Exception {
202191
port = shuffleServer.getPort();
203192
boundPort = port;
204193
String authEnabledString = authEnabled ? "enabled" : "not enabled";
194+
195+
// register metrics on the block handler into the Node Manager's metrics system.
196+
blockHandler.getAllMetrics().getMetrics().put("numRegisteredConnections",
197+
shuffleServer.getRegisteredConnections());
198+
YarnShuffleServiceMetrics serviceMetrics =
199+
new YarnShuffleServiceMetrics(blockHandler.getAllMetrics());
200+
201+
MetricsSystemImpl metricsSystem = (MetricsSystemImpl) DefaultMetricsSystem.instance();
202+
metricsSystem.register(
203+
"sparkShuffleService", "Metrics on the Spark Shuffle Service", serviceMetrics);
204+
logger.info("Registered metrics with Hadoop's DefaultMetricsSystem");
205+
205206
logger.info("Started YARN shuffle service for Spark on port {}. " +
206207
"Authentication is {}. Registered executor file is {}", port, authEnabledString,
207208
registeredExecutorFile);

common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleServiceMetrics.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ public static void collectMetric(
113113
metricsRecordBuilder.addGauge(new ShuffleServiceMetricsInfo(name, "Number of " +
114114
"connections to shuffle service " + name), counterValue);
115115
}
116-
117116
}
118117

119118
private static MetricsInfo getShuffleServiceMetricsInfo(String name) {

0 commit comments

Comments
 (0)