Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YUNIKORN-2895] Don't add duplicated allocation to node when the allo… #976

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pkg/scheduler/objects/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -1594,12 +1594,24 @@
node.RemoveAllocation(ask.GetAllocationKey())
return nil, nil
}

// mark this ask as allocated
// If the allocation already exists, we should not add it to the node again, it will potentially cause the orphan allocation issue.
_, err := sa.allocateAsk(ask)
if err != nil {
log.Log(log.SchedApplication).Warn("allocation of ask failed unexpectedly",
zap.Error(err))
// revert the node update
node.RemoveAllocation(ask.GetAllocationKey())

Check warning on line 1605 in pkg/scheduler/objects/application.go

View check run for this annotation

Codecov / codecov/patch

pkg/scheduler/objects/application.go#L1605

Added line #L1605 was not covered by tests
// revert the queue update
err = sa.queue.DecAllocatedResource(ask.GetAllocatedResource())
if err != nil {
log.Log(log.SchedApplication).DPanic("queue update failed unexpectedly",
zap.Error(err))

Check warning on line 1610 in pkg/scheduler/objects/application.go

View check run for this annotation

Codecov / codecov/patch

pkg/scheduler/objects/application.go#L1607-L1610

Added lines #L1607 - L1610 were not covered by tests
}
return nil, nil

Check warning on line 1612 in pkg/scheduler/objects/application.go

View check run for this annotation

Codecov / codecov/patch

pkg/scheduler/objects/application.go#L1612

Added line #L1612 was not covered by tests
}

// all is OK, last update for the app
result := newAllocatedAllocationResult(node.NodeID, ask)
sa.addAllocationInternal(result.ResultType, ask)
Expand Down
Loading