From 35472617498c98c822d6693c32db691983a70e18 Mon Sep 17 00:00:00 2001 From: bibinchundatt Date: Wed, 21 Aug 2019 13:48:21 +0530 Subject: [PATCH] YARN-9765. SLS runner crashes when run with metrics turned off. Contributed by Abhishek Modi. (cherry picked from commit 10ec31d20ee1b6a0b1da915acb6b6ec33f2cd415) --- .../src/main/java/org/apache/hadoop/yarn/sls/SLSRunner.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/SLSRunner.java b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/SLSRunner.java index 44aaf7484e4..70676a9f378 100644 --- a/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/SLSRunner.java +++ b/hadoop-tools/hadoop-sls/src/main/java/org/apache/hadoop/yarn/sls/SLSRunner.java @@ -76,6 +76,7 @@ import org.apache.hadoop.yarn.sls.conf.SLSConfiguration; import org.apache.hadoop.yarn.sls.nodemanager.NMSimulator; import org.apache.hadoop.yarn.sls.resourcemanager.MockAMLauncher; import org.apache.hadoop.yarn.sls.scheduler.SLSCapacityScheduler; +import org.apache.hadoop.yarn.sls.scheduler.SchedulerMetrics; import org.apache.hadoop.yarn.sls.scheduler.TaskRunner; import org.apache.hadoop.yarn.sls.scheduler.SLSFairScheduler; import org.apache.hadoop.yarn.sls.scheduler.ContainerSimulator; @@ -732,7 +733,10 @@ public class SLSRunner extends Configured implements Tool { } queueAppNumMap.put(queueName, appNum); - wrapper.getSchedulerMetrics().trackQueue(queueName); + SchedulerMetrics metrics = wrapper.getSchedulerMetrics(); + if (metrics != null) { + metrics.trackQueue(queueName); + } } private void runNewAM(String jobType, String user,