Skip to content

Commit

Permalink
[hotfix][runtime] Minor cleanup in SlotManager
Browse files Browse the repository at this point in the history
Avoid checking whether slots would be fulfillable unless necessary
  • Loading branch information
StephanEwen committed Jul 10, 2019
1 parent caf89b1 commit be794ac
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -758,13 +758,15 @@ private void internalRequestSlot(PendingSlotRequest pendingSlotRequest) throws R
pendingTaskManagerSlotOptional = allocateResource(resourceProfile);
}

pendingTaskManagerSlotOptional.ifPresent(pendingTaskManagerSlot -> assignPendingTaskManagerSlot(pendingSlotRequest, pendingTaskManagerSlot));
if (!pendingTaskManagerSlotOptional.isPresent()) {
if (pendingTaskManagerSlotOptional.isPresent()) {
assignPendingTaskManagerSlot(pendingSlotRequest, pendingTaskManagerSlotOptional.get());
}
else {
// request can not be fulfilled by any free slot or pending slot that can be allocated,
// check whether it can be fulfilled by allocated slots
boolean fulfillable = isFulfillableByRegisteredSlots(pendingSlotRequest.getResourceProfile());
if (!fulfillable && failUnfulfillableRequest) {
throw new ResourceManagerException("Requested resource profile (" + pendingSlotRequest.getResourceProfile() + ") is unfulfillable.");
if (failUnfulfillableRequest && !isFulfillableByRegisteredSlots(pendingSlotRequest.getResourceProfile())) {
throw new ResourceManagerException("Requested resource profile (" +
pendingSlotRequest.getResourceProfile() + ") is unfulfillable.");
}
}
}
Expand Down

0 comments on commit be794ac

Please sign in to comment.