YARN-1726. ResourceSchedulerWrapper broken due to AbstractYarnScheduler. (Wei Yan via kasha)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1613547 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9cfde45b45
commit
b0c2c85619
@ -63,6 +63,8 @@ import org.apache.hadoop.yarn.security.AMRMTokenIdentifier;
|
|||||||
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
|
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
|
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
|
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
|
||||||
|
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt;
|
||||||
|
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState;
|
||||||
import org.apache.hadoop.yarn.util.Records;
|
import org.apache.hadoop.yarn.util.Records;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
@ -133,8 +135,7 @@ public abstract class AMSimulator extends TaskRunner.Task {
|
|||||||
* register with RM
|
* register with RM
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void firstStep()
|
public void firstStep() throws Exception {
|
||||||
throws YarnException, IOException, InterruptedException {
|
|
||||||
simulateStartTimeMS = System.currentTimeMillis() -
|
simulateStartTimeMS = System.currentTimeMillis() -
|
||||||
SLSRunner.getRunner().getStartTimeMS();
|
SLSRunner.getRunner().getStartTimeMS();
|
||||||
|
|
||||||
@ -149,8 +150,7 @@ public abstract class AMSimulator extends TaskRunner.Task {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void middleStep()
|
public void middleStep() throws Exception {
|
||||||
throws InterruptedException, YarnException, IOException {
|
|
||||||
// process responses in the queue
|
// process responses in the queue
|
||||||
processResponseQueue();
|
processResponseQueue();
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ public abstract class AMSimulator extends TaskRunner.Task {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void lastStep() {
|
public void lastStep() throws Exception {
|
||||||
LOG.info(MessageFormat.format("Application {0} is shutting down.", appId));
|
LOG.info(MessageFormat.format("Application {0} is shutting down.", appId));
|
||||||
// unregister tracking
|
// unregister tracking
|
||||||
if (isTracked) {
|
if (isTracked) {
|
||||||
@ -173,26 +173,19 @@ public abstract class AMSimulator extends TaskRunner.Task {
|
|||||||
.newRecordInstance(FinishApplicationMasterRequest.class);
|
.newRecordInstance(FinishApplicationMasterRequest.class);
|
||||||
finishAMRequest.setFinalApplicationStatus(FinalApplicationStatus.SUCCEEDED);
|
finishAMRequest.setFinalApplicationStatus(FinalApplicationStatus.SUCCEEDED);
|
||||||
|
|
||||||
try {
|
UserGroupInformation ugi =
|
||||||
UserGroupInformation ugi =
|
UserGroupInformation.createRemoteUser(appAttemptId.toString());
|
||||||
UserGroupInformation.createRemoteUser(appAttemptId.toString());
|
Token<AMRMTokenIdentifier> token = rm.getRMContext().getRMApps().get(appId)
|
||||||
Token<AMRMTokenIdentifier> token =
|
.getRMAppAttempt(appAttemptId).getAMRMToken();
|
||||||
rm.getRMContext().getRMApps().get(appAttemptId.getApplicationId())
|
ugi.addTokenIdentifier(token.decodeIdentifier());
|
||||||
.getRMAppAttempt(appAttemptId).getAMRMToken();
|
ugi.doAs(new PrivilegedExceptionAction<Object>() {
|
||||||
ugi.addTokenIdentifier(token.decodeIdentifier());
|
@Override
|
||||||
ugi.doAs(new PrivilegedExceptionAction<Object>() {
|
public Object run() throws Exception {
|
||||||
@Override
|
rm.getApplicationMasterService()
|
||||||
public Object run() throws Exception {
|
.finishApplicationMaster(finishAMRequest);
|
||||||
rm.getApplicationMasterService()
|
return null;
|
||||||
.finishApplicationMaster(finishAMRequest);
|
}
|
||||||
return null;
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
simulateFinishTimeMS = System.currentTimeMillis() -
|
simulateFinishTimeMS = System.currentTimeMillis() -
|
||||||
SLSRunner.getRunner().getStartTimeMS();
|
SLSRunner.getRunner().getStartTimeMS();
|
||||||
@ -230,11 +223,9 @@ public abstract class AMSimulator extends TaskRunner.Task {
|
|||||||
return createAllocateRequest(ask, new ArrayList<ContainerId>());
|
return createAllocateRequest(ask, new ArrayList<ContainerId>());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void processResponseQueue()
|
protected abstract void processResponseQueue() throws Exception;
|
||||||
throws InterruptedException, YarnException, IOException;
|
|
||||||
|
|
||||||
protected abstract void sendContainerRequest()
|
protected abstract void sendContainerRequest() throws Exception;
|
||||||
throws YarnException, IOException, InterruptedException;
|
|
||||||
|
|
||||||
protected abstract void checkStop();
|
protected abstract void checkStop();
|
||||||
|
|
||||||
@ -280,11 +271,18 @@ public abstract class AMSimulator extends TaskRunner.Task {
|
|||||||
// waiting until application ACCEPTED
|
// waiting until application ACCEPTED
|
||||||
RMApp app = rm.getRMContext().getRMApps().get(appId);
|
RMApp app = rm.getRMContext().getRMApps().get(appId);
|
||||||
while(app.getState() != RMAppState.ACCEPTED) {
|
while(app.getState() != RMAppState.ACCEPTED) {
|
||||||
Thread.sleep(50);
|
Thread.sleep(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
appAttemptId = rm.getRMContext().getRMApps().get(appId)
|
// Waiting until application attempt reach LAUNCHED
|
||||||
.getCurrentAppAttempt().getAppAttemptId();
|
// "Unmanaged AM must register after AM attempt reaches LAUNCHED state"
|
||||||
|
this.appAttemptId = rm.getRMContext().getRMApps().get(appId)
|
||||||
|
.getCurrentAppAttempt().getAppAttemptId();
|
||||||
|
RMAppAttempt rmAppAttempt = rm.getRMContext().getRMApps().get(appId)
|
||||||
|
.getCurrentAppAttempt();
|
||||||
|
while (rmAppAttempt.getAppAttemptState() != RMAppAttemptState.LAUNCHED) {
|
||||||
|
Thread.sleep(10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerAM()
|
private void registerAM()
|
||||||
@ -297,10 +295,9 @@ public abstract class AMSimulator extends TaskRunner.Task {
|
|||||||
amRegisterRequest.setTrackingUrl("localhost:1000");
|
amRegisterRequest.setTrackingUrl("localhost:1000");
|
||||||
|
|
||||||
UserGroupInformation ugi =
|
UserGroupInformation ugi =
|
||||||
UserGroupInformation.createRemoteUser(appAttemptId.toString());
|
UserGroupInformation.createRemoteUser(appAttemptId.toString());
|
||||||
Token<AMRMTokenIdentifier> token =
|
Token<AMRMTokenIdentifier> token = rm.getRMContext().getRMApps().get(appId)
|
||||||
rm.getRMContext().getRMApps().get(appAttemptId.getApplicationId())
|
.getRMAppAttempt(appAttemptId).getAMRMToken();
|
||||||
.getRMAppAttempt(appAttemptId).getAMRMToken();
|
|
||||||
ugi.addTokenIdentifier(token.decodeIdentifier());
|
ugi.addTokenIdentifier(token.decodeIdentifier());
|
||||||
|
|
||||||
ugi.doAs(
|
ugi.doAs(
|
||||||
|
@ -145,8 +145,7 @@ public class MRAMSimulator extends AMSimulator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void firstStep()
|
public void firstStep() throws Exception {
|
||||||
throws YarnException, IOException, InterruptedException {
|
|
||||||
super.firstStep();
|
super.firstStep();
|
||||||
|
|
||||||
requestAMContainer();
|
requestAMContainer();
|
||||||
@ -390,7 +389,7 @@ public class MRAMSimulator extends AMSimulator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void lastStep() {
|
public void lastStep() throws Exception {
|
||||||
super.lastStep();
|
super.lastStep();
|
||||||
|
|
||||||
// clear data structures
|
// clear data structures
|
||||||
|
@ -27,6 +27,7 @@ import java.util.Map;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.DelayQueue;
|
import java.util.concurrent.DelayQueue;
|
||||||
|
|
||||||
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||||
@ -107,12 +108,12 @@ public class NMSimulator extends TaskRunner.Task {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void firstStep() throws YarnException, IOException {
|
public void firstStep() {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void middleStep() {
|
public void middleStep() throws Exception {
|
||||||
// we check the lifetime for each running containers
|
// we check the lifetime for each running containers
|
||||||
ContainerSimulator cs = null;
|
ContainerSimulator cs = null;
|
||||||
synchronized(completedContainerList) {
|
synchronized(completedContainerList) {
|
||||||
@ -136,37 +137,31 @@ public class NMSimulator extends TaskRunner.Task {
|
|||||||
ns.setResponseId(RESPONSE_ID ++);
|
ns.setResponseId(RESPONSE_ID ++);
|
||||||
ns.setNodeHealthStatus(NodeHealthStatus.newInstance(true, "", 0));
|
ns.setNodeHealthStatus(NodeHealthStatus.newInstance(true, "", 0));
|
||||||
beatRequest.setNodeStatus(ns);
|
beatRequest.setNodeStatus(ns);
|
||||||
try {
|
NodeHeartbeatResponse beatResponse =
|
||||||
NodeHeartbeatResponse beatResponse =
|
rm.getResourceTrackerService().nodeHeartbeat(beatRequest);
|
||||||
rm.getResourceTrackerService().nodeHeartbeat(beatRequest);
|
if (! beatResponse.getContainersToCleanup().isEmpty()) {
|
||||||
if (! beatResponse.getContainersToCleanup().isEmpty()) {
|
// remove from queue
|
||||||
// remove from queue
|
synchronized(releasedContainerList) {
|
||||||
synchronized(releasedContainerList) {
|
for (ContainerId containerId : beatResponse.getContainersToCleanup()){
|
||||||
for (ContainerId containerId : beatResponse.getContainersToCleanup()){
|
if (amContainerList.contains(containerId)) {
|
||||||
if (amContainerList.contains(containerId)) {
|
// AM container (not killed?, only release)
|
||||||
// AM container (not killed?, only release)
|
synchronized(amContainerList) {
|
||||||
synchronized(amContainerList) {
|
amContainerList.remove(containerId);
|
||||||
amContainerList.remove(containerId);
|
|
||||||
}
|
|
||||||
LOG.debug(MessageFormat.format("NodeManager {0} releases " +
|
|
||||||
"an AM ({1}).", node.getNodeID(), containerId));
|
|
||||||
} else {
|
|
||||||
cs = runningContainers.remove(containerId);
|
|
||||||
containerQueue.remove(cs);
|
|
||||||
releasedContainerList.add(containerId);
|
|
||||||
LOG.debug(MessageFormat.format("NodeManager {0} releases a " +
|
|
||||||
"container ({1}).", node.getNodeID(), containerId));
|
|
||||||
}
|
}
|
||||||
|
LOG.debug(MessageFormat.format("NodeManager {0} releases " +
|
||||||
|
"an AM ({1}).", node.getNodeID(), containerId));
|
||||||
|
} else {
|
||||||
|
cs = runningContainers.remove(containerId);
|
||||||
|
containerQueue.remove(cs);
|
||||||
|
releasedContainerList.add(containerId);
|
||||||
|
LOG.debug(MessageFormat.format("NodeManager {0} releases a " +
|
||||||
|
"container ({1}).", node.getNodeID(), containerId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (beatResponse.getNodeAction() == NodeAction.SHUTDOWN) {
|
}
|
||||||
lastStep();
|
if (beatResponse.getNodeAction() == NodeAction.SHUTDOWN) {
|
||||||
}
|
lastStep();
|
||||||
} catch (YarnException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,4 +257,19 @@ public class NMSimulator extends TaskRunner.Task {
|
|||||||
completedContainerList.add(containerId);
|
completedContainerList.add(containerId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
Map<ContainerId, ContainerSimulator> getRunningContainers() {
|
||||||
|
return runningContainers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
List<ContainerId> getAMContainers() {
|
||||||
|
return amContainerList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
List<ContainerId> getCompletedContainers() {
|
||||||
|
return completedContainerList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation;
|
|||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerAppReport;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerAppReport;
|
||||||
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplication;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplicationAttempt;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerNode;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerNode;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerNodeReport;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerNodeReport;
|
||||||
@ -101,7 +102,6 @@ final public class ResourceSchedulerWrapper
|
|||||||
private static final String EOL = System.getProperty("line.separator");
|
private static final String EOL = System.getProperty("line.separator");
|
||||||
private static final int SAMPLING_SIZE = 60;
|
private static final int SAMPLING_SIZE = 60;
|
||||||
private ScheduledExecutorService pool;
|
private ScheduledExecutorService pool;
|
||||||
private RMContext rmContext;
|
|
||||||
// counters for scheduler allocate/handle operations
|
// counters for scheduler allocate/handle operations
|
||||||
private Counter schedulerAllocateCounter;
|
private Counter schedulerAllocateCounter;
|
||||||
private Counter schedulerHandleCounter;
|
private Counter schedulerHandleCounter;
|
||||||
@ -576,7 +576,7 @@ final public class ResourceSchedulerWrapper
|
|||||||
new Gauge<Integer>() {
|
new Gauge<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
public Integer getValue() {
|
public Integer getValue() {
|
||||||
if(scheduler == null || scheduler.getRootQueueMetrics() == null) {
|
if (scheduler == null || scheduler.getRootQueueMetrics() == null) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return scheduler.getRootQueueMetrics().getAppsRunning();
|
return scheduler.getRootQueueMetrics().getAppsRunning();
|
||||||
@ -723,17 +723,18 @@ final public class ResourceSchedulerWrapper
|
|||||||
public void addAMRuntime(ApplicationId appId,
|
public void addAMRuntime(ApplicationId appId,
|
||||||
long traceStartTimeMS, long traceEndTimeMS,
|
long traceStartTimeMS, long traceEndTimeMS,
|
||||||
long simulateStartTimeMS, long simulateEndTimeMS) {
|
long simulateStartTimeMS, long simulateEndTimeMS) {
|
||||||
|
if (metricsON) {
|
||||||
try {
|
try {
|
||||||
// write job runtime information
|
// write job runtime information
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(appId).append(",").append(traceStartTimeMS).append(",")
|
sb.append(appId).append(",").append(traceStartTimeMS).append(",")
|
||||||
.append(traceEndTimeMS).append(",").append(simulateStartTimeMS)
|
.append(traceEndTimeMS).append(",").append(simulateStartTimeMS)
|
||||||
.append(",").append(simulateEndTimeMS);
|
.append(",").append(simulateEndTimeMS);
|
||||||
jobRuntimeLogBW.write(sb.toString() + EOL);
|
jobRuntimeLogBW.write(sb.toString() + EOL);
|
||||||
jobRuntimeLogBW.flush();
|
jobRuntimeLogBW.flush();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -919,4 +920,17 @@ final public class ResourceSchedulerWrapper
|
|||||||
public Resource getClusterResource() {
|
public Resource getClusterResource() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public synchronized List<Container> getTransferredContainers(
|
||||||
|
ApplicationAttemptId currentAttempt) {
|
||||||
|
return new ArrayList<Container>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<ApplicationId, SchedulerApplication<SchedulerApplicationAttempt>>
|
||||||
|
getSchedulerApplications() {
|
||||||
|
return new HashMap<ApplicationId,
|
||||||
|
SchedulerApplication<SchedulerApplicationAttempt>>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -729,16 +729,18 @@ public class SLSCapacityScheduler extends CapacityScheduler implements
|
|||||||
long traceStartTimeMS, long traceEndTimeMS,
|
long traceStartTimeMS, long traceEndTimeMS,
|
||||||
long simulateStartTimeMS, long simulateEndTimeMS) {
|
long simulateStartTimeMS, long simulateEndTimeMS) {
|
||||||
|
|
||||||
try {
|
if (metricsON) {
|
||||||
// write job runtime information
|
try {
|
||||||
StringBuilder sb = new StringBuilder();
|
// write job runtime information
|
||||||
sb.append(appId).append(",").append(traceStartTimeMS).append(",")
|
StringBuilder sb = new StringBuilder();
|
||||||
.append(traceEndTimeMS).append(",").append(simulateStartTimeMS)
|
sb.append(appId).append(",").append(traceStartTimeMS).append(",")
|
||||||
.append(",").append(simulateEndTimeMS);
|
.append(traceEndTimeMS).append(",").append(simulateStartTimeMS)
|
||||||
jobRuntimeLogBW.write(sb.toString() + EOL);
|
.append(",").append(simulateEndTimeMS);
|
||||||
jobRuntimeLogBW.flush();
|
jobRuntimeLogBW.write(sb.toString() + EOL);
|
||||||
} catch (IOException e) {
|
jobRuntimeLogBW.flush();
|
||||||
e.printStackTrace();
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,12 +99,10 @@ public class TaskRunner {
|
|||||||
} else {
|
} else {
|
||||||
lastStep();
|
lastStep();
|
||||||
}
|
}
|
||||||
} catch (YarnException e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
Thread.getDefaultUncaughtExceptionHandler()
|
||||||
|
.uncaughtException(Thread.currentThread(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,13 +122,11 @@ public class TaskRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public abstract void firstStep()
|
public abstract void firstStep() throws Exception;
|
||||||
throws YarnException, IOException, InterruptedException;
|
|
||||||
|
|
||||||
public abstract void middleStep()
|
public abstract void middleStep() throws Exception;
|
||||||
throws YarnException, InterruptedException, IOException;
|
|
||||||
|
|
||||||
public abstract void lastStep() throws YarnException;
|
public abstract void lastStep() throws Exception;
|
||||||
|
|
||||||
public void setEndTime(long et) {
|
public void setEndTime(long et) {
|
||||||
endTime = et;
|
endTime = et;
|
||||||
|
@ -18,10 +18,13 @@
|
|||||||
|
|
||||||
package org.apache.hadoop.yarn.sls;
|
package org.apache.hadoop.yarn.sls;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class TestSLSRunner {
|
public class TestSLSRunner {
|
||||||
@ -30,6 +33,15 @@ public class TestSLSRunner {
|
|||||||
@SuppressWarnings("all")
|
@SuppressWarnings("all")
|
||||||
public void testSimulatorRunning() throws Exception {
|
public void testSimulatorRunning() throws Exception {
|
||||||
File tempDir = new File("target", UUID.randomUUID().toString());
|
File tempDir = new File("target", UUID.randomUUID().toString());
|
||||||
|
final List<Throwable> exceptionList =
|
||||||
|
Collections.synchronizedList(new ArrayList<Throwable>());
|
||||||
|
|
||||||
|
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
||||||
|
@Override
|
||||||
|
public void uncaughtException(Thread t, Throwable e) {
|
||||||
|
exceptionList.add(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// start the simulator
|
// start the simulator
|
||||||
File slsOutputDir = new File(tempDir.getAbsolutePath() + "/slsoutput/");
|
File slsOutputDir = new File(tempDir.getAbsolutePath() + "/slsoutput/");
|
||||||
@ -38,8 +50,20 @@ public class TestSLSRunner {
|
|||||||
"-output", slsOutputDir.getAbsolutePath()};
|
"-output", slsOutputDir.getAbsolutePath()};
|
||||||
SLSRunner.main(args);
|
SLSRunner.main(args);
|
||||||
|
|
||||||
// wait for 45 seconds before stop
|
// wait for 20 seconds before stop
|
||||||
Thread.sleep(45 * 1000);
|
int count = 20;
|
||||||
|
while (count >= 0) {
|
||||||
|
Thread.sleep(1000);
|
||||||
|
|
||||||
|
if (! exceptionList.isEmpty()) {
|
||||||
|
SLSRunner.getRunner().stop();
|
||||||
|
Assert.fail("TestSLSRunner catched exception from child thread " +
|
||||||
|
"(TaskRunner.Task): " + exceptionList.get(0).getMessage());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
count--;
|
||||||
|
}
|
||||||
|
|
||||||
SLSRunner.getRunner().stop();
|
SLSRunner.getRunner().stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,6 +444,9 @@ Release 2.5.0 - UNRELEASED
|
|||||||
|
|
||||||
YARN-2335. Annotate all hadoop-sls APIs as @Private. (Wei Yan via kasha)
|
YARN-2335. Annotate all hadoop-sls APIs as @Private. (Wei Yan via kasha)
|
||||||
|
|
||||||
|
YARN-1726. ResourceSchedulerWrapper broken due to AbstractYarnScheduler.
|
||||||
|
(Wei Yan via kasha)
|
||||||
|
|
||||||
Release 2.4.1 - 2014-06-23
|
Release 2.4.1 - 2014-06-23
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
Loading…
x
Reference in New Issue
Block a user