YARN-7200. SLS generates a realtimetrack.json file but that file is missing the closing ']'. Contributed by Agshin Kazimli
This commit is contained in:
parent
630f8ddd2c
commit
6cd540e964
@ -159,6 +159,10 @@ public enum TraceType {
|
|||||||
private TraceType inputType;
|
private TraceType inputType;
|
||||||
private SynthTraceJobProducer stjp;
|
private SynthTraceJobProducer stjp;
|
||||||
|
|
||||||
|
public static int getRemainingApps() {
|
||||||
|
return remainingApps;
|
||||||
|
}
|
||||||
|
|
||||||
public SLSRunner() throws ClassNotFoundException {
|
public SLSRunner() throws ClassNotFoundException {
|
||||||
Configuration tempConf = new Configuration(false);
|
Configuration tempConf = new Configuration(false);
|
||||||
init(tempConf);
|
init(tempConf);
|
||||||
@ -933,14 +937,14 @@ public Map<NodeId, NMSimulator> getNmMap() {
|
|||||||
|
|
||||||
public static void decreaseRemainingApps() {
|
public static void decreaseRemainingApps() {
|
||||||
remainingApps--;
|
remainingApps--;
|
||||||
|
}
|
||||||
|
|
||||||
if (remainingApps == 0) {
|
public static void exitSLSRunner() {
|
||||||
LOG.info("SLSRunner tears down.");
|
LOG.info("SLSRunner tears down.");
|
||||||
if (exitAtTheFinish) {
|
if (exitAtTheFinish) {
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void stop() throws InterruptedException {
|
public void stop() throws InterruptedException {
|
||||||
rm.stop();
|
rm.stop();
|
||||||
|
@ -54,6 +54,8 @@
|
|||||||
import org.apache.hadoop.yarn.sls.SLSRunner;
|
import org.apache.hadoop.yarn.sls.SLSRunner;
|
||||||
import org.apache.hadoop.yarn.sls.conf.SLSConfiguration;
|
import org.apache.hadoop.yarn.sls.conf.SLSConfiguration;
|
||||||
import org.apache.hadoop.yarn.util.resource.Resources;
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.codahale.metrics.Timer;
|
import com.codahale.metrics.Timer;
|
||||||
|
|
||||||
@ -75,6 +77,9 @@ public class SLSCapacityScheduler extends CapacityScheduler implements
|
|||||||
private boolean metricsON;
|
private boolean metricsON;
|
||||||
private Tracker tracker;
|
private Tracker tracker;
|
||||||
|
|
||||||
|
// logger
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(SLSCapacityScheduler.class);
|
||||||
|
|
||||||
public Tracker getTracker() {
|
public Tracker getTracker() {
|
||||||
return tracker;
|
return tracker;
|
||||||
}
|
}
|
||||||
@ -218,6 +223,14 @@ public void handle(SchedulerEvent schedulerEvent) {
|
|||||||
AppAttemptRemovedSchedulerEvent appRemoveEvent =
|
AppAttemptRemovedSchedulerEvent appRemoveEvent =
|
||||||
(AppAttemptRemovedSchedulerEvent) schedulerEvent;
|
(AppAttemptRemovedSchedulerEvent) schedulerEvent;
|
||||||
appQueueMap.remove(appRemoveEvent.getApplicationAttemptID());
|
appQueueMap.remove(appRemoveEvent.getApplicationAttemptID());
|
||||||
|
if (SLSRunner.getRemainingApps() == 0) {
|
||||||
|
try {
|
||||||
|
getSchedulerMetrics().tearDown();
|
||||||
|
SLSRunner.exitSLSRunner();
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.error("Scheduler Metrics failed to tear down.", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (schedulerEvent.getType() ==
|
} else if (schedulerEvent.getType() ==
|
||||||
SchedulerEventType.APP_ATTEMPT_ADDED
|
SchedulerEventType.APP_ATTEMPT_ADDED
|
||||||
&& schedulerEvent instanceof AppAttemptAddedSchedulerEvent) {
|
&& schedulerEvent instanceof AppAttemptAddedSchedulerEvent) {
|
||||||
|
@ -44,6 +44,8 @@
|
|||||||
import org.apache.hadoop.yarn.sls.SLSRunner;
|
import org.apache.hadoop.yarn.sls.SLSRunner;
|
||||||
import org.apache.hadoop.yarn.sls.conf.SLSConfiguration;
|
import org.apache.hadoop.yarn.sls.conf.SLSConfiguration;
|
||||||
import org.apache.hadoop.yarn.util.resource.Resources;
|
import org.apache.hadoop.yarn.util.resource.Resources;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -63,6 +65,9 @@ public class SLSFairScheduler extends FairScheduler
|
|||||||
private Map<ContainerId, Resource> preemptionContainerMap =
|
private Map<ContainerId, Resource> preemptionContainerMap =
|
||||||
new ConcurrentHashMap<>();
|
new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
// logger
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(SLSCapacityScheduler.class);
|
||||||
|
|
||||||
public SchedulerMetrics getSchedulerMetrics() {
|
public SchedulerMetrics getSchedulerMetrics() {
|
||||||
return schedulerMetrics;
|
return schedulerMetrics;
|
||||||
}
|
}
|
||||||
@ -182,6 +187,14 @@ public void handle(SchedulerEvent schedulerEvent) {
|
|||||||
if (schedulerEvent.getType() == SchedulerEventType.APP_ATTEMPT_REMOVED
|
if (schedulerEvent.getType() == SchedulerEventType.APP_ATTEMPT_REMOVED
|
||||||
&& schedulerEvent instanceof AppAttemptRemovedSchedulerEvent) {
|
&& schedulerEvent instanceof AppAttemptRemovedSchedulerEvent) {
|
||||||
SLSRunner.decreaseRemainingApps();
|
SLSRunner.decreaseRemainingApps();
|
||||||
|
if (SLSRunner.getRemainingApps() == 0) {
|
||||||
|
try {
|
||||||
|
getSchedulerMetrics().tearDown();
|
||||||
|
SLSRunner.exitSLSRunner();
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.error("Scheduler Metrics failed to tear down.", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -539,9 +539,13 @@ public void run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void tearDown() throws Exception {
|
void tearDown() throws Exception {
|
||||||
|
setRunning(false);
|
||||||
|
LOG.info("Scheduler Metrics tears down");
|
||||||
if (metricsLogBW != null) {
|
if (metricsLogBW != null) {
|
||||||
metricsLogBW.write("]");
|
metricsLogBW.write("]");
|
||||||
metricsLogBW.close();
|
metricsLogBW.close();
|
||||||
|
//metricsLogBW is nullified to prevent the usage after closing
|
||||||
|
metricsLogBW = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (web != null) {
|
if (web != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user