ResourceRequestInfo(Long allocationRequestId, Priority priority, String resourceName, Resource capability, boolean relaxLocality) { remoteRequest = ResourceRequest.newBuilder().priority(priority) .resourceName(resourceName).capability(capability).numContainers(0) .allocationRequestId(allocationRequestId).relaxLocality(relaxLocality) .build(); containerRequests = new LinkedHashSet<T>(); } }
@Public @Stable public static ResourceRequest newInstance(Priority priority, String hostName, Resource capability, int numContainers) { return ResourceRequest.newBuilder().priority(priority) .resourceName(hostName).capability(capability) .numContainers(numContainers).build(); }
@Public @Stable public static ResourceRequest newInstance(Priority priority, String hostName, Resource capability, int numContainers, boolean relaxLocality) { return ResourceRequest.newBuilder().priority(priority) .resourceName(hostName).capability(capability) .numContainers(numContainers).relaxLocality(relaxLocality).build(); }
@Public @Stable public static ResourceRequest newInstance(Priority priority, String hostName, Resource capability, int numContainers, boolean relaxLocality, String labelExpression) { return ResourceRequest.newBuilder().priority(priority) .resourceName(hostName).capability(capability) .numContainers(numContainers).relaxLocality(relaxLocality) .nodeLabelExpression(labelExpression).build(); }
ResourceRequest rr = ResourceRequest.newBuilder() .priority(Priority.UNDEFINED).resourceName(ResourceRequest.ANY) .capability(minimumAllocation).numContainers(numCont).build();
@Public @Evolving public static ResourceRequest newInstance(Priority priority, String hostName, Resource capability, int numContainers, boolean relaxLocality, String labelExpression, ExecutionTypeRequest executionTypeRequest) { return ResourceRequest.newBuilder().priority(priority) .resourceName(hostName).capability(capability) .numContainers(numContainers).relaxLocality(relaxLocality) .nodeLabelExpression(labelExpression) .executionTypeRequest(executionTypeRequest) .build(); }
ResourceRequest amReqs = ResourceRequest.newBuilder() .capability(Resource.newInstance(5 * GB, 3)).build(); createApplicationWithAMResource(appAttemptId1, "queueA", "user1",
am1.allocate(Collections.singletonList(ResourceRequest.newBuilder() .capability(ResourceTypesTestHelper.newResource(4 * GB, 1, ImmutableMap.<String, String> builder()
List<ResourceRequest> reqs = Arrays.asList( ResourceRequest.newBuilder().allocationRequestId(1) .priority(Priority.newInstance(1)) .resourceName(ResourceRequest.ANY) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(2) .priority(Priority.newInstance(1)) .resourceName(ResourceRequest.ANY) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(3) .priority(Priority.newInstance(1)) .resourceName(ResourceRequest.ANY)
am1.allocate(Collections.singletonList(ResourceRequest.newBuilder() .capability(Resource.newInstance(9 * GB, 1)) .numContainers(1) try { am1.allocate(Collections.singletonList(ResourceRequest.newBuilder() .capability(Resource.newInstance(8 * GB, 18)) .numContainers(1)
List<ResourceRequest> reqs = new ArrayList<>(); for (int i = 0; i < 100; i++) { reqs.add(ResourceRequest.newBuilder().allocationRequestId(i + 1) .priority(Priority.newInstance(1)) .resourceName("*") .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build()); reqs.add(ResourceRequest.newBuilder().allocationRequestId(i + 1) .priority(Priority.newInstance(1)) .resourceName("h1") .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build()); reqs.add(ResourceRequest.newBuilder().allocationRequestId(i + 1) .priority(Priority.newInstance(1)) .resourceName("/r1")
List<ResourceRequest> reqs = Arrays.asList( ResourceRequest.newBuilder().allocationRequestId(2) .numContainers(2) .priority(Priority.newInstance(1)) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(2) .numContainers(2) .priority(Priority.newInstance(1)) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(2) .numContainers(2) .priority(Priority.newInstance(1))
/** * Clone a ResourceRequest object (shallow copy). Please keep it loaded with * all (new) fields * * @param rr the object to copy from * @return the copied object */ @Public @Evolving public static ResourceRequest clone(ResourceRequest rr) { // Please keep it loaded with all (new) fields return ResourceRequest.newBuilder().priority(rr.getPriority()) .resourceName(rr.getResourceName()).capability(rr.getCapability()) .numContainers(rr.getNumContainers()) .relaxLocality(rr.getRelaxLocality()) .nodeLabelExpression(rr.getNodeLabelExpression()) .executionTypeRequest(rr.getExecutionTypeRequest()) .allocationRequestId(rr.getAllocationRequestId()).build(); }
List<ResourceRequest> reqs = Arrays.asList( ResourceRequest.newBuilder().allocationRequestId(1) .priority(Priority.newInstance(1)) .resourceName("/r1") .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(1) .priority(Priority.newInstance(1)) .resourceName("h1") .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(1) .priority(Priority.newInstance(1)) .resourceName(ResourceRequest.ANY) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(2) .priority(Priority.newInstance(1)) .resourceName("/r1") .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(2) .priority(Priority.newInstance(1)) .resourceName("h1")
am1.allocate(Collections.singletonList(ResourceRequest.newBuilder() .capability(TestUtils.createResource(9 * GB, 1, ImmutableMap.of("res_1", 1))) try { am1.allocate(Collections.singletonList(ResourceRequest.newBuilder() .capability( TestUtils.createResource(8 * GB, 18, ImmutableMap.of("res_1", 1))) try { am1.allocate(Collections.singletonList(ResourceRequest.newBuilder() .capability(TestUtils.createResource(8 * GB, 1, ImmutableMap.of("res_1", 100)))
List<ResourceRequest> reqs = Arrays.asList( ResourceRequest.newBuilder().allocationRequestId(1) .priority(Priority.newInstance(1)) .resourceName("/r1") .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(1) .priority(Priority.newInstance(1)) .resourceName("h1") .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(1) .priority(Priority.newInstance(1)) .resourceName(ResourceRequest.ANY) .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(2) .priority(Priority.newInstance(1)) .resourceName("/r1") .relaxLocality(true) .executionType(ExecutionType.OPPORTUNISTIC).build(), ResourceRequest.newBuilder().allocationRequestId(2) .priority(Priority.newInstance(1)) .resourceName("h1")