[ https://issues.apache.org/jira/browse/YARN-3992?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14649001#comment-14649001 ]
Rohith Sharma K S commented on YARN-3992: ----------------------------------------- Thanks [~sunilg] for providing the patch!! One comment # Instead of rewritting below code twice, can you use method {{MockAM#allocateAndWaitForContainers}} so many lines of code can be avoided. {code} + int NUM_CONTAINERS = 7; + // allocate NUM_CONTAINERS containers + am1.allocate("127.0.0.1", 2 * GB, NUM_CONTAINERS, + new ArrayList<ContainerId>()); nm1.nodeHeartbeat(true); - while (alloc1Response.getAllocatedContainers().size() < 1) { - LOG.info("Waiting for containers to be created for app 1..."); - Thread.sleep(100); - alloc1Response = am1.schedule(); + + // wait for containers to be allocated. + List<Container> allocated1 = am1.allocate(new ArrayList<ResourceRequest>(), + new ArrayList<ContainerId>()).getAllocatedContainers(); + while (allocated1.size() != NUM_CONTAINERS) { + nm1.nodeHeartbeat(true); + allocated1.addAll(am1.allocate(new ArrayList<ResourceRequest>(), + new ArrayList<ContainerId>()).getAllocatedContainers()); + Thread.sleep(200); } {code} > TestApplicationPriority.testApplicationPriorityAllocation fails intermittently > ------------------------------------------------------------------------------ > > Key: YARN-3992 > URL: https://issues.apache.org/jira/browse/YARN-3992 > Project: Hadoop YARN > Issue Type: Test > Reporter: Zhijie Shen > Assignee: Sunil G > Attachments: 0001-YARN-3992.patch > > > {code} > java.lang.AssertionError: expected:<7> but was:<5> > at org.junit.Assert.fail(Assert.java:88) > at org.junit.Assert.failNotEquals(Assert.java:743) > at org.junit.Assert.assertEquals(Assert.java:118) > at org.junit.Assert.assertEquals(Assert.java:555) > at org.junit.Assert.assertEquals(Assert.java:542) > at > org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.TestApplicationPriority.testApplicationPriorityAllocation(TestApplicationPriority.java:182) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)