YARN-585. Fix failure in TestFairScheduler#testNotAllowSubmitApplication caused by YARN-514. Contributed by Zhijie Shen.

svn merge --ignore-ancestry -c 1469492 ../../trunk/


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1469494 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vinod Kumar Vavilapalli 2013-04-18 17:49:57 +00:00
parent 8f02b5951b
commit 27bef76501
3 changed files with 22 additions and 3 deletions

View File

@ -189,6 +189,9 @@ Release 2.0.5-beta - UNRELEASED
YARN-476. ProcfsBasedProcessTree info message confuses users. YARN-476. ProcfsBasedProcessTree info message confuses users.
(sandyr via tucu) (sandyr via tucu)
YARN-585. Fix failure in TestFairScheduler#testNotAllowSubmitApplication
caused by YARN-514. (Zhijie Shen via vinodkv)
Release 2.0.4-alpha - UNRELEASED Release 2.0.4-alpha - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -178,6 +178,9 @@ public class TestRMAppTransitions {
if(submissionContext == null) { if(submissionContext == null) {
submissionContext = new ApplicationSubmissionContextPBImpl(); submissionContext = new ApplicationSubmissionContextPBImpl();
} }
// applicationId will not be used because RMStateStore is mocked,
// but applicationId is still set for safety
submissionContext.setApplicationId(applicationId);
RMApp application = RMApp application =
new RMAppImpl(applicationId, rmContext, conf, name, user, queue, new RMAppImpl(applicationId, rmContext, conf, name, user, queue,

View File

@ -63,6 +63,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEventType; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEventType;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppImpl; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppImpl;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState;
import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer;
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode; import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode;
@ -1411,6 +1412,7 @@ public class TestFairScheduler {
ContainerLaunchContext clc = ContainerLaunchContext clc =
BuilderUtils.newContainerLaunchContext(user, null, null, null, null, BuilderUtils.newContainerLaunchContext(user, null, null, null, null,
null, null); null, null);
submissionContext.setApplicationId(applicationId);
submissionContext.setAMContainerSpec(clc); submissionContext.setAMContainerSpec(clc);
RMApp application = RMApp application =
new RMAppImpl(applicationId, resourceManager.getRMContext(), conf, name, user, new RMAppImpl(applicationId, resourceManager.getRMContext(), conf, name, user,
@ -1419,13 +1421,24 @@ public class TestFairScheduler {
resourceManager.getRMContext().getRMApps().putIfAbsent(applicationId, application); resourceManager.getRMContext().getRMApps().putIfAbsent(applicationId, application);
application.handle(new RMAppEvent(applicationId, RMAppEventType.START)); application.handle(new RMAppEvent(applicationId, RMAppEventType.START));
final int MAX_TRIES=20;
int numTries = 0;
while (!application.getState().equals(RMAppState.SUBMITTED) &&
numTries < MAX_TRIES) {
try {
Thread.sleep(100);
} catch (InterruptedException ex) {ex.printStackTrace();}
numTries++;
}
assertEquals("The application doesn't reach SUBMITTED.",
RMAppState.SUBMITTED, application.getState());
ApplicationAttemptId attId = recordFactory.newRecordInstance(ApplicationAttemptId.class); ApplicationAttemptId attId = recordFactory.newRecordInstance(ApplicationAttemptId.class);
attId.setAttemptId(this.ATTEMPT_ID++); attId.setAttemptId(this.ATTEMPT_ID++);
attId.setApplicationId(applicationId); attId.setApplicationId(applicationId);
scheduler.addApplication(attId, queue, user); scheduler.addApplication(attId, queue, user);
final int MAX_TRIES=20; numTries = 0;
int numTries = 0;
while (application.getFinishTime() == 0 && numTries < MAX_TRIES) { while (application.getFinishTime() == 0 && numTries < MAX_TRIES) {
try { try {
Thread.sleep(100); Thread.sleep(100);