private void internalRequestSlot ( PendingSlotRequest pendingSlotRequest ) throws ResourceManagerException { final ResourceProfile resourceProfile = pendingSlotRequest . getResourceProfile ( ) ; TaskManagerSlot taskManagerSlot = findMatchingSlot ( resourceProfile ) ; if ( taskManagerSlot != null ) { allocateSlot ( taskManagerSlot , pendingSlotRequest ) ; } else { Optional < PendingTaskManagerSlot > pendingTaskManagerSlotOptional = findFreeMatchingPendingTaskManagerSlot ( resourceProfile ) ; if ( ! pendingTaskManagerSlotOptional . isPresent ( ) ) { pendingTaskManagerSlotOptional = allocateResource ( resourceProfile ) ; } pendingTaskManagerSlotOptional . ifPresent ( pendingTaskManagerSlot -> assignPendingTaskManagerSlot ( pendingSlotRequest , pendingTaskManagerSlot ) ) ; } }
Tries to allocate a slot for the given slot request . If there is no slot available the resource manager is informed to allocate more resources and a timeout for the request is registered .