YARN-7372. TestContainerSchedulerQueuing.testContainerUpdateExecTypeGuaranteedToOpportunistic is flaky.
This commit is contained in:
parent
0477eff8be
commit
480187aebb
@ -21,14 +21,17 @@
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
|
||||||
|
import com.google.common.base.Supplier;
|
||||||
import org.apache.hadoop.fs.UnsupportedFileSystemException;
|
import org.apache.hadoop.fs.UnsupportedFileSystemException;
|
||||||
import org.apache.hadoop.security.UserGroupInformation;
|
import org.apache.hadoop.security.UserGroupInformation;
|
||||||
|
import org.apache.hadoop.test.GenericTestUtils;
|
||||||
import org.apache.hadoop.yarn.api.protocolrecords.ContainerUpdateRequest;
|
import org.apache.hadoop.yarn.api.protocolrecords.ContainerUpdateRequest;
|
||||||
import org.apache.hadoop.yarn.api.protocolrecords.ContainerUpdateResponse;
|
import org.apache.hadoop.yarn.api.protocolrecords.ContainerUpdateResponse;
|
||||||
import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusesRequest;
|
import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusesRequest;
|
||||||
@ -1247,7 +1250,7 @@ public void testPromotionOfOpportunisticContainers() throws Exception {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testContainerUpdateExecTypeGuaranteedToOpportunistic()
|
public void testContainerUpdateExecTypeGuaranteedToOpportunistic()
|
||||||
throws IOException, YarnException, InterruptedException {
|
throws Exception {
|
||||||
delayContainers = true;
|
delayContainers = true;
|
||||||
containerManager.start();
|
containerManager.start();
|
||||||
// Construct the Container-id
|
// Construct the Container-id
|
||||||
@ -1287,11 +1290,28 @@ public void testContainerUpdateExecTypeGuaranteedToOpportunistic()
|
|||||||
1, updateResponse.getSuccessfullyUpdatedContainers().size());
|
1, updateResponse.getSuccessfullyUpdatedContainers().size());
|
||||||
Assert.assertTrue(updateResponse.getFailedRequests().isEmpty());
|
Assert.assertTrue(updateResponse.getFailedRequests().isEmpty());
|
||||||
|
|
||||||
//Make sure the container is running
|
|
||||||
List<ContainerId> statList = new ArrayList<ContainerId>();
|
|
||||||
statList.add(cId);
|
|
||||||
GetContainerStatusesRequest statRequest =
|
GetContainerStatusesRequest statRequest =
|
||||||
GetContainerStatusesRequest.newInstance(statList);
|
GetContainerStatusesRequest.newInstance(Collections.singletonList(cId));
|
||||||
|
GenericTestUtils.waitFor(
|
||||||
|
new Supplier<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public Boolean get() {
|
||||||
|
try {
|
||||||
|
List<ContainerStatus> containerStatuses = containerManager
|
||||||
|
.getContainerStatuses(statRequest).getContainerStatuses();
|
||||||
|
Assert.assertEquals(1, containerStatuses.size());
|
||||||
|
|
||||||
|
ContainerStatus status = containerStatuses.get(0);
|
||||||
|
Assert.assertEquals(
|
||||||
|
org.apache.hadoop.yarn.api.records.ContainerState.RUNNING,
|
||||||
|
status.getState());
|
||||||
|
|
||||||
|
return status.getExecutionType() == ExecutionType.OPPORTUNISTIC;
|
||||||
|
} catch (Exception ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 100, 10000);
|
||||||
List<ContainerStatus> containerStatuses = containerManager
|
List<ContainerStatus> containerStatuses = containerManager
|
||||||
.getContainerStatuses(statRequest).getContainerStatuses();
|
.getContainerStatuses(statRequest).getContainerStatuses();
|
||||||
Assert.assertEquals(1, containerStatuses.size());
|
Assert.assertEquals(1, containerStatuses.size());
|
||||||
|
Loading…
Reference in New Issue
Block a user