private SchedulingRequestProto convertToProtoFormat( SchedulingRequest t) { return ((SchedulingRequestPBImpl) t).getProto(); }
private synchronized YarnProtos.SchedulingRequestProto convertToProtoFormat( SchedulingRequest r) { return ((SchedulingRequestPBImpl)r).getProto(); }
@Override public int hashCode() { return getProto().hashCode(); }
@Override public ContainerRequest allocate(SchedulerRequestKey schedulerKey, NodeType type, SchedulerNode node) { writeLock.lock(); try { // Per container scheduling request, it is just a copy of existing // scheduling request with #allocations=1 SchedulingRequest containerSchedulingRequest = new SchedulingRequestPBImpl( ((SchedulingRequestPBImpl) schedulingRequest).getProto()); containerSchedulingRequest.getResourceSizing().setNumAllocations(1); // Deduct sizing decreasePendingNumAllocation(); return new ContainerRequest(containerSchedulingRequest); } finally { writeLock.unlock(); } }
private void validateAndSetSchedulingRequest(SchedulingRequest newSchedulingRequest) throws SchedulerInvalidResoureRequestException { // Check sizing exists if (newSchedulingRequest.getResourceSizing() == null || newSchedulingRequest.getResourceSizing().getResources() == null) { throwExceptionWithMetaInfo( "No ResourceSizing found in the scheduling request, please double " + "check"); } // Check execution type == GUARANTEED if (newSchedulingRequest.getExecutionType() != null && newSchedulingRequest.getExecutionType().getExecutionType() != ExecutionType.GUARANTEED) { throwExceptionWithMetaInfo( "Only GUARANTEED execution type is supported."); } this.targetNodePartition = validateAndGetTargetNodePartition( newSchedulingRequest.getPlacementConstraint()); this.schedulingRequest = new SchedulingRequestPBImpl( ((SchedulingRequestPBImpl) newSchedulingRequest).getProto()); LOG.info("Successfully added SchedulingRequest to app=" + appSchedulingInfo.getApplicationAttemptId() + " placementConstraint=[" + schedulingRequest.getPlacementConstraint() + "]. nodePartition=" + targetNodePartition); }