craigcondit commented on a change in pull request #365:
URL:
https://github.com/apache/incubator-yunikorn-k8shim/pull/365#discussion_r802131870
##########
File path: pkg/cache/external/scheduler_cache.go
##########
@@ -353,22 +359,15 @@ func (cache *SchedulerCache) ForgetPod(pod *v1.Pod) error
{
currState, ok := cache.podsMap[key]
if ok && currState.Spec.NodeName != pod.Spec.NodeName {
- return fmt.Errorf("pod %v was assumed on %v but assigned to %v",
- key, pod.Spec.NodeName, currState.Spec.NodeName)
+ log.Logger().Warn("pod was assumed on one node but found on
another",
+ zap.String("pod", key),
+ zap.String("expectedNode", currState.Spec.NodeName),
+ zap.String("actualNode", pod.Spec.NodeName))
}
- switch {
- // Only assumed pod can be forgotten.
- case ok && cache.isAssumedPod(key):
- err = cache.removePod(pod)
- if err != nil {
- return err
- }
- delete(cache.assumedPods, key)
- delete(cache.podsMap, key)
- default:
- return fmt.Errorf("pod %v wasn't assumed so cannot be
forgotten", key)
- }
+ delete(cache.assumedPods, key)
+ delete(cache.pendingAllocations, key)
+ delete(cache.inProgressAllocations, key)
Review comment:
Removed most of this logic as it's just horribly broken. We now ensure
that we cleanup the cache regardless of its current state, and we log a warning
if the pod was assigned to an unexpected node instead of throwing an error.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]