wangdatan commented on a change in pull request #151:
URL:
https://github.com/apache/incubator-yunikorn-core/pull/151#discussion_r427568879
##########
File path: pkg/scheduler/scheduler.go
##########
@@ -315,9 +318,24 @@ func (s *Scheduler) processAllocationUpdateEvent(ev
*schedulerevent.SchedulerAll
if len(ev.AcceptedAllocations) > 0 {
alloc := ev.AcceptedAllocations[0]
// Update pending resource
- if err := s.confirmAllocationProposal(alloc); err != nil {
+ if err :=
s.confirmAllocationProposal(alloc.AllocationProposal); err != nil {
log.Logger().Error("failed to confirm allocation
proposal",
zap.Error(err))
+ // if the scheduler could not confirm the proposal,
+ // we need to notify the cache to revert the allocations
+ for _, allocInfo := range alloc.Allocations {
+
s.eventHandlers.CacheEventHandler.HandleEvent(&cacheevent.ReleaseAllocationsEvent{
Review comment:
Since Once Cache received ReleaseAllocationsEvent, Cache will notify
RMProxy:
```
m.notifyRMAllocationReleased(rmID, releasedAllocations,
toReleaseAllocation.ReleaseType, toReleaseAllocation.Message)
```
For this case (scheduler cannot confirm allocation), I think we should skip
notifying RM, because this is not an allocation RM aware of.
##########
File path: pkg/scheduler/scheduling_partition.go
##########
@@ -439,36 +440,45 @@ func (psc *partitionSchedulingContext) allocate(alloc
*schedulingAllocation) boo
// Called for both allocations from reserved as well as for direct allocations.
// The unreserve is already handled before we get here so there is no
difference in handling.
// Lock free call this must be called holding the context lock
-func (psc *partitionSchedulingContext) confirmAllocation(appID, nodeID,
allocKey string, confirm bool) error {
+func (psc *partitionSchedulingContext) confirmAllocation(proposal
*commonevents.AllocationProposal, confirm bool) error {
Review comment:
We also need to notify RMProxy about the confirmed allocation,
previously Cache notifies RMProxy about confirmed allocation, now since
scheduler will do confirmation and have chances to fail, we need to move the
notification scheduler (once allocation is confirmed).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]