OpportunisticContainerAllocator { public List<Container> allocateContainers(ResourceBlacklistRequest blackList, List<ResourceRequest> oppResourceReqs, ApplicationAttemptId applicationAttemptId, OpportunisticContainerContext opportContext, long rmIdentifier, String appSubmitter) throws YarnException { if (blackList != null) { opportContext.getBlacklist().removeAll(blackList.getBlacklistRemovals()); opportContext.getBlacklist().addAll(blackList.getBlacklistAdditions()); } opportContext.addToOutstandingReqs(oppResourceReqs); Set<String> nodeBlackList = new HashSet<>(opportContext.getBlacklist()); List<Container> allocatedContainers = new ArrayList<>(); boolean continueLoop = true; while (continueLoop) { continueLoop = false; List<Map<Resource, List<Allocation>>> allocations = new ArrayList<>(); for (SchedulerRequestKey schedulerKey : opportContext.getOutstandingOpReqs().descendingKeySet()) { Map<Resource, List<Allocation>> allocation = allocate( rmIdentifier, opportContext, schedulerKey, applicationAttemptId, appSubmitter, nodeBlackList); if (allocation.size() > 0) { allocations.add(allocation); continueLoop = true; } } for (Map<Resource, List<Allocation>> allocation : allocations) { for (Map.Entry<Resource, List<Allocation>> e : allocation.entrySet()) { opportContext.matchAllocationToOutstandingRequest( e.getKey(), e.getValue()); for (Allocation alloc : e.getValue()) { allocatedContainers.add(alloc.getContainer()); } } } } return allocatedContainers; } OpportunisticContainerAllocator(
      BaseContainerTokenSecretManager tokenSecretManager); List<Container> allocateContainers(ResourceBlacklistRequest blackList,
      List<ResourceRequest> oppResourceReqs,
      ApplicationAttemptId applicationAttemptId,
      OpportunisticContainerContext opportContext, long rmIdentifier,
      String appSubmitter); PartitionedResourceRequests partitionAskList(
      List<ResourceRequest> askList);  }
@Test public void testSimpleAllocation() throws Exception { ResourceBlacklistRequest blacklistRequest = ResourceBlacklistRequest.newInstance( new ArrayList<>(), new ArrayList<>()); List<ResourceRequest> reqs = Arrays.asList(ResourceRequest.newInstance(Priority.newInstance(1), "*", Resources.createResource(1 * GB), 1, true, null, ExecutionTypeRequest.newInstance( ExecutionType.OPPORTUNISTIC, true))); ApplicationAttemptId appAttId = ApplicationAttemptId.newInstance( ApplicationId.newInstance(0L, 1), 1); oppCntxt.updateNodeList( Arrays.asList( RemoteNode.newInstance( NodeId.newInstance("h1", 1234), "h1:1234", "/r1"))); List<Container> containers = allocator.allocateContainers( blacklistRequest, reqs, appAttId, oppCntxt, 1L, "luser"); Assert.assertEquals(1, containers.size()); Assert.assertEquals(0, oppCntxt.getOutstandingOpReqs().size()); }
@Test public void testBlacklistRejection() throws Exception { ResourceBlacklistRequest blacklistRequest = ResourceBlacklistRequest.newInstance( Arrays.asList("h1", "h2"), new ArrayList<>()); List<ResourceRequest> reqs = Arrays.asList(ResourceRequest.newInstance(Priority.newInstance(1), "*", Resources.createResource(1 * GB), 1, true, null, ExecutionTypeRequest.newInstance( ExecutionType.OPPORTUNISTIC, true))); ApplicationAttemptId appAttId = ApplicationAttemptId.newInstance( ApplicationId.newInstance(0L, 1), 1); oppCntxt.updateNodeList( Arrays.asList( RemoteNode.newInstance( NodeId.newInstance("h1", 1234), "h1:1234", "/r1"), RemoteNode.newInstance( NodeId.newInstance("h2", 1234), "h2:1234", "/r2"))); List<Container> containers = allocator.allocateContainers( blacklistRequest, reqs, appAttId, oppCntxt, 1L, "luser"); Assert.assertEquals(0, containers.size()); Assert.assertEquals(1, oppCntxt.getOutstandingOpReqs().size()); }
@Test public void testRoundRobinSimpleAllocation() throws Exception { ResourceBlacklistRequest blacklistRequest = ResourceBlacklistRequest.newInstance( new ArrayList<>(), new ArrayList<>()); List<ResourceRequest> reqs = Arrays.asList( ResourceRequest.newBuilder().allocationRequestId(1) .priority(Priority.newInstance(1)) .resourceName(ResourceRequest.ANY) .capability(Resources.createResource(1 * GB)) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(2) .priority(Priority.newInstance(1)) .resourceName(ResourceRequest.ANY) .capability(Resources.createResource(1 * GB)) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(3) .priority(Priority.newInstance(1)) .resourceName(ResourceRequest.ANY) .capability(Resources.createResource(1 * GB)) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build()); ApplicationAttemptId appAttId = ApplicationAttemptId.newInstance( ApplicationId.newInstance(0L, 1), 1); oppCntxt.updateNodeList( Arrays.asList( RemoteNode.newInstance( NodeId.newInstance("h1", 1234), "h1:1234", "/r1"), RemoteNode.newInstance( NodeId.newInstance("h2", 1234), "h2:1234", "/r1"), RemoteNode.newInstance( NodeId.newInstance("h3", 1234), "h3:1234", "/r1"))); List<Container> containers = allocator.allocateContainers( blacklistRequest, reqs, appAttId, oppCntxt, 1L, "luser"); System.out.println(containers); Set<String> allocatedHosts = new HashSet<>(); for (Container c : containers) { allocatedHosts.add(c.getNodeHttpAddress()); } Assert.assertTrue(allocatedHosts.contains("h1:1234")); Assert.assertTrue(allocatedHosts.contains("h2:1234")); Assert.assertTrue(allocatedHosts.contains("h3:1234")); Assert.assertEquals(3, containers.size()); }
@Test public void testNodeLocalAllocation() throws Exception { ResourceBlacklistRequest blacklistRequest = ResourceBlacklistRequest.newInstance( new ArrayList<>(), new ArrayList<>()); List<ResourceRequest> reqs = Arrays.asList( ResourceRequest.newBuilder().allocationRequestId(1) .priority(Priority.newInstance(1)) .resourceName("/r1") .capability(Resources.createResource(1 * GB)) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(1) .priority(Priority.newInstance(1)) .resourceName("h1") .capability(Resources.createResource(1 * GB)) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(1) .priority(Priority.newInstance(1)) .resourceName(ResourceRequest.ANY) .capability(Resources.createResource(1 * GB)) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(2) .priority(Priority.newInstance(1)) .resourceName("/r1") .capability(Resources.createResource(1 * GB)) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(2) .priority(Priority.newInstance(1)) .resourceName("h1") .capability(Resources.createResource(1 * GB)) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(2) .priority(Priority.newInstance(1)) .resourceName(ResourceRequest.ANY) .capability(Resources.createResource(1 * GB)) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build()); ApplicationAttemptId appAttId = ApplicationAttemptId.newInstance( ApplicationId.newInstance(0L, 1), 1); oppCntxt.updateNodeList( Arrays.asList( RemoteNode.newInstance( NodeId.newInstance("h1", 1234), "h1:1234", "/r1"), RemoteNode.newInstance( NodeId.newInstance("h2", 1234), "h2:1234", "/r1"), RemoteNode.newInstance( NodeId.newInstance("h3", 1234), "h3:1234", "/r1"))); List<Container> containers = allocator.allocateContainers( blacklistRequest, reqs, appAttId, oppCntxt, 1L, "luser"); System.out.println(containers); Set<String> allocatedHosts = new HashSet<>(); for (Container c : containers) { allocatedHosts.add(c.getNodeHttpAddress()); } Assert.assertEquals(2, containers.size()); Assert.assertTrue(allocatedHosts.contains("h1:1234")); Assert.assertFalse(allocatedHosts.contains("h2:1234")); Assert.assertFalse(allocatedHosts.contains("h3:1234")); }
@Test public void testNodeLocalAllocationSameSchedKey() throws Exception { ResourceBlacklistRequest blacklistRequest = ResourceBlacklistRequest.newInstance( new ArrayList<>(), new ArrayList<>()); List<ResourceRequest> reqs = Arrays.asList( ResourceRequest.newBuilder().allocationRequestId(2) .numContainers(2) .priority(Priority.newInstance(1)) .resourceName("/r1") .capability(Resources.createResource(1 * GB)) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(2) .numContainers(2) .priority(Priority.newInstance(1)) .resourceName("h1") .capability(Resources.createResource(1 * GB)) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(2) .numContainers(2) .priority(Priority.newInstance(1)) .resourceName(ResourceRequest.ANY) .capability(Resources.createResource(1 * GB)) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build()); ApplicationAttemptId appAttId = ApplicationAttemptId.newInstance( ApplicationId.newInstance(0L, 1), 1); oppCntxt.updateNodeList( Arrays.asList( RemoteNode.newInstance( NodeId.newInstance("h1", 1234), "h1:1234", "/r1"), RemoteNode.newInstance( NodeId.newInstance("h2", 1234), "h2:1234", "/r1"), RemoteNode.newInstance( NodeId.newInstance("h3", 1234), "h3:1234", "/r1"))); List<Container> containers = allocator.allocateContainers( blacklistRequest, reqs, appAttId, oppCntxt, 1L, "luser"); System.out.println(containers); Set<String> allocatedHosts = new HashSet<>(); for (Container c : containers) { allocatedHosts.add(c.getNodeHttpAddress()); } Assert.assertEquals(2, containers.size()); Assert.assertTrue(allocatedHosts.contains("h1:1234")); Assert.assertFalse(allocatedHosts.contains("h2:1234")); Assert.assertFalse(allocatedHosts.contains("h3:1234")); }
@Test public void testSimpleRackLocalAllocation() throws Exception { ResourceBlacklistRequest blacklistRequest = ResourceBlacklistRequest.newInstance( new ArrayList<>(), new ArrayList<>()); List<ResourceRequest> reqs = Arrays.asList( ResourceRequest.newInstance(Priority.newInstance(1), "*", Resources.createResource(1 * GB), 1, true, null, ExecutionTypeRequest.newInstance( ExecutionType.OPPORTUNISTIC, true)), ResourceRequest.newInstance(Priority.newInstance(1), "h1", Resources.createResource(1 * GB), 1, true, null, ExecutionTypeRequest.newInstance( ExecutionType.OPPORTUNISTIC, true)), ResourceRequest.newInstance(Priority.newInstance(1), "/r1", Resources.createResource(1 * GB), 1, true, null, ExecutionTypeRequest.newInstance( ExecutionType.OPPORTUNISTIC, true))); ApplicationAttemptId appAttId = ApplicationAttemptId.newInstance( ApplicationId.newInstance(0L, 1), 1); oppCntxt.updateNodeList( Arrays.asList( RemoteNode.newInstance( NodeId.newInstance("h3", 1234), "h3:1234", "/r2"), RemoteNode.newInstance( NodeId.newInstance("h2", 1234), "h2:1234", "/r1"), RemoteNode.newInstance( NodeId.newInstance("h4", 1234), "h4:1234", "/r2"))); List<Container> containers = allocator.allocateContainers( blacklistRequest, reqs, appAttId, oppCntxt, 1L, "luser"); Set<String> allocatedHosts = new HashSet<>(); for (Container c : containers) { allocatedHosts.add(c.getNodeHttpAddress()); } Assert.assertTrue(allocatedHosts.contains("h2:1234")); Assert.assertFalse(allocatedHosts.contains("h3:1234")); Assert.assertFalse(allocatedHosts.contains("h4:1234")); Assert.assertEquals(1, containers.size()); }
@Test public void testRoundRobinRackLocalAllocation() throws Exception { ResourceBlacklistRequest blacklistRequest = ResourceBlacklistRequest.newInstance( new ArrayList<>(), new ArrayList<>()); List<ResourceRequest> reqs = Arrays.asList( ResourceRequest.newBuilder().allocationRequestId(1) .priority(Priority.newInstance(1)) .resourceName("/r1") .capability(Resources.createResource(1 * GB)) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(1) .priority(Priority.newInstance(1)) .resourceName("h1") .capability(Resources.createResource(1 * GB)) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(1) .priority(Priority.newInstance(1)) .resourceName(ResourceRequest.ANY) .capability(Resources.createResource(1 * GB)) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(2) .priority(Priority.newInstance(1)) .resourceName("/r1") .capability(Resources.createResource(1 * GB)) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(2) .priority(Priority.newInstance(1)) .resourceName("h1") .capability(Resources.createResource(1 * GB)) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(2) .priority(Priority.newInstance(1)) .resourceName(ResourceRequest.ANY) .capability(Resources.createResource(1 * GB)) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build()); ApplicationAttemptId appAttId = ApplicationAttemptId.newInstance( ApplicationId.newInstance(0L, 1), 1); oppCntxt.updateNodeList( Arrays.asList( RemoteNode.newInstance( NodeId.newInstance("h3", 1234), "h3:1234", "/r2"), RemoteNode.newInstance( NodeId.newInstance("h2", 1234), "h2:1234", "/r1"), RemoteNode.newInstance( NodeId.newInstance("h5", 1234), "h5:1234", "/r1"), RemoteNode.newInstance( NodeId.newInstance("h4", 1234), "h4:1234", "/r2"))); List<Container> containers = allocator.allocateContainers( blacklistRequest, reqs, appAttId, oppCntxt, 1L, "luser"); Set<String> allocatedHosts = new HashSet<>(); for (Container c : containers) { allocatedHosts.add(c.getNodeHttpAddress()); } System.out.println(containers); Assert.assertTrue(allocatedHosts.contains("h2:1234")); Assert.assertTrue(allocatedHosts.contains("h5:1234")); Assert.assertFalse(allocatedHosts.contains("h3:1234")); Assert.assertFalse(allocatedHosts.contains("h4:1234")); Assert.assertEquals(2, containers.size()); }
@Test public void testRoundRobinRackLocalAllocationSameSchedKey() throws Exception { ResourceBlacklistRequest blacklistRequest = ResourceBlacklistRequest.newInstance( new ArrayList<>(), new ArrayList<>()); List<ResourceRequest> reqs = Arrays.asList( ResourceRequest.newInstance(Priority.newInstance(1), "*", Resources.createResource(1 * GB), 2, true, null, ExecutionTypeRequest.newInstance( ExecutionType.OPPORTUNISTIC, true)), ResourceRequest.newInstance(Priority.newInstance(1), "h1", Resources.createResource(1 * GB), 2, true, null, ExecutionTypeRequest.newInstance( ExecutionType.OPPORTUNISTIC, true)), ResourceRequest.newInstance(Priority.newInstance(1), "/r1", Resources.createResource(1 * GB), 2, true, null, ExecutionTypeRequest.newInstance( ExecutionType.OPPORTUNISTIC, true))); ApplicationAttemptId appAttId = ApplicationAttemptId.newInstance( ApplicationId.newInstance(0L, 1), 1); oppCntxt.updateNodeList( Arrays.asList( RemoteNode.newInstance( NodeId.newInstance("h3", 1234), "h3:1234", "/r2"), RemoteNode.newInstance( NodeId.newInstance("h2", 1234), "h2:1234", "/r1"), RemoteNode.newInstance( NodeId.newInstance("h5", 1234), "h5:1234", "/r1"), RemoteNode.newInstance( NodeId.newInstance("h4", 1234), "h4:1234", "/r2"))); List<Container> containers = allocator.allocateContainers( blacklistRequest, reqs, appAttId, oppCntxt, 1L, "luser"); Set<String> allocatedHosts = new HashSet<>(); for (Container c : containers) { allocatedHosts.add(c.getNodeHttpAddress()); } System.out.println(containers); Assert.assertTrue(allocatedHosts.contains("h2:1234")); Assert.assertTrue(allocatedHosts.contains("h5:1234")); Assert.assertFalse(allocatedHosts.contains("h3:1234")); Assert.assertFalse(allocatedHosts.contains("h4:1234")); Assert.assertEquals(2, containers.size()); }
@Test public void testOffSwitchAllocationWhenNoNodeOrRack() throws Exception { ResourceBlacklistRequest blacklistRequest = ResourceBlacklistRequest.newInstance( new ArrayList<>(), new ArrayList<>()); List<ResourceRequest> reqs = Arrays.asList( ResourceRequest.newInstance(Priority.newInstance(1), "*", Resources.createResource(1 * GB), 2, true, null, ExecutionTypeRequest.newInstance( ExecutionType.OPPORTUNISTIC, true)), ResourceRequest.newInstance(Priority.newInstance(1), "h6", Resources.createResource(1 * GB), 2, true, null, ExecutionTypeRequest.newInstance( ExecutionType.OPPORTUNISTIC, true)), ResourceRequest.newInstance(Priority.newInstance(1), "/r3", Resources.createResource(1 * GB), 2, true, null, ExecutionTypeRequest.newInstance( ExecutionType.OPPORTUNISTIC, true))); ApplicationAttemptId appAttId = ApplicationAttemptId.newInstance( ApplicationId.newInstance(0L, 1), 1); oppCntxt.updateNodeList( Arrays.asList( RemoteNode.newInstance( NodeId.newInstance("h3", 1234), "h3:1234", "/r2"), RemoteNode.newInstance( NodeId.newInstance("h2", 1234), "h2:1234", "/r1"), RemoteNode.newInstance( NodeId.newInstance("h5", 1234), "h5:1234", "/r1"), RemoteNode.newInstance( NodeId.newInstance("h4", 1234), "h4:1234", "/r2"))); List<Container> containers = allocator.allocateContainers( blacklistRequest, reqs, appAttId, oppCntxt, 1L, "luser"); System.out.println(containers); Assert.assertEquals(2, containers.size()); }
@Test public void testLotsOfContainersRackLocalAllocationSameSchedKey() throws Exception { ResourceBlacklistRequest blacklistRequest = ResourceBlacklistRequest.newInstance( new ArrayList<>(), new ArrayList<>()); List<ResourceRequest> reqs = Arrays.asList( ResourceRequest.newInstance(Priority.newInstance(1), "*", Resources.createResource(1 * GB), 1000, true, null, ExecutionTypeRequest.newInstance( ExecutionType.OPPORTUNISTIC, true)), ResourceRequest.newInstance(Priority.newInstance(1), "h1", Resources.createResource(1 * GB), 1000, true, null, ExecutionTypeRequest.newInstance( ExecutionType.OPPORTUNISTIC, true)), ResourceRequest.newInstance(Priority.newInstance(1), "/r1", Resources.createResource(1 * GB), 1000, true, null, ExecutionTypeRequest.newInstance( ExecutionType.OPPORTUNISTIC, true))); ApplicationAttemptId appAttId = ApplicationAttemptId.newInstance( ApplicationId.newInstance(0L, 1), 1); oppCntxt.updateNodeList( Arrays.asList( RemoteNode.newInstance( NodeId.newInstance("h3", 1234), "h3:1234", "/r2"), RemoteNode.newInstance( NodeId.newInstance("h2", 1234), "h2:1234", "/r1"), RemoteNode.newInstance( NodeId.newInstance("h5", 1234), "h5:1234", "/r1"), RemoteNode.newInstance( NodeId.newInstance("h4", 1234), "h4:1234", "/r2"))); List<Container> containers = new ArrayList<>(); for (int i = 0; i < 250; i++) { containers.addAll(allocator.allocateContainers( blacklistRequest, reqs, appAttId, oppCntxt, 1L, "luser")); } Assert.assertEquals(1000, containers.size()); }
@Test public void testLotsOfContainersRackLocalAllocation() throws Exception { ResourceBlacklistRequest blacklistRequest = ResourceBlacklistRequest.newInstance( new ArrayList<>(), new ArrayList<>()); List<ResourceRequest> reqs = new ArrayList<>(); for (int i = 0; i < 100; i++) { reqs.add(ResourceRequest.newBuilder().allocationRequestId(i + 1) .priority(Priority.newInstance(1)) .resourceName("*") .capability(Resources.createResource(1 * GB)) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build()); reqs.add(ResourceRequest.newBuilder().allocationRequestId(i + 1) .priority(Priority.newInstance(1)) .resourceName("h1") .capability(Resources.createResource(1 * GB)) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build()); reqs.add(ResourceRequest.newBuilder().allocationRequestId(i + 1) .priority(Priority.newInstance(1)) .resourceName("/r1") .capability(Resources.createResource(1 * GB)) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build()); } ApplicationAttemptId appAttId = ApplicationAttemptId.newInstance( ApplicationId.newInstance(0L, 1), 1); oppCntxt.updateNodeList( Arrays.asList( RemoteNode.newInstance( NodeId.newInstance("h3", 1234), "h3:1234", "/r2"), RemoteNode.newInstance( NodeId.newInstance("h2", 1234), "h2:1234", "/r1"), RemoteNode.newInstance( NodeId.newInstance("h5", 1234), "h5:1234", "/r1"), RemoteNode.newInstance( NodeId.newInstance("h4", 1234), "h4:1234", "/r2"))); List<Container> containers = new ArrayList<>(); for (int i = 0; i < 25; i++) { containers.addAll(allocator.allocateContainers( blacklistRequest, reqs, appAttId, oppCntxt, 1L, "luser")); } Assert.assertEquals(100, containers.size()); }
@Test public void testAllocationWithNodeLabels() throws Exception { ResourceBlacklistRequest blacklistRequest = ResourceBlacklistRequest.newInstance( new ArrayList<>(), new ArrayList<>()); List<ResourceRequest> reqs = Arrays.asList(ResourceRequest.newInstance(Priority.newInstance(1), "*", Resources.createResource(1 * GB), 1, true, "label", ExecutionTypeRequest.newInstance( ExecutionType.OPPORTUNISTIC, true))); ApplicationAttemptId appAttId = ApplicationAttemptId.newInstance( ApplicationId.newInstance(0L, 1), 1); oppCntxt.updateNodeList( Arrays.asList( RemoteNode.newInstance( NodeId.newInstance("h1", 1234), "h1:1234", "/r1"))); List<Container> containers = allocator.allocateContainers( blacklistRequest, reqs, appAttId, oppCntxt, 1L, "luser"); Assert.assertEquals(0, containers.size()); Assert.assertEquals(1, oppCntxt.getOutstandingOpReqs().size()); oppCntxt.updateNodeList( Arrays.asList( RemoteNode.newInstance( NodeId.newInstance("h1", 1234), "h1:1234", "/r1", "label"))); containers = allocator.allocateContainers( blacklistRequest, reqs, appAttId, oppCntxt, 1L, "luser"); Assert.assertEquals(1, containers.size()); Assert.assertEquals(0, oppCntxt.getOutstandingOpReqs().size()); }