Skip to content

Commit

Permalink
[YUNIKORN-2879] [shim] yunikorn unschedulable pods pending forever
Browse files Browse the repository at this point in the history
* task postfail or rejected reschedule
  • Loading branch information
zhangjian16 committed Oct 24, 2024
1 parent e434137 commit 946c410
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions pkg/cache/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -693,34 +693,3 @@ func (task *Task) RetryThenFailTask(errorMessage, actionReason string) {
task.failWithEvent(errorMessage, actionReason)
}
}
func (task *Task) setRetryTimer(timeout time.Duration, currentState string, event RetryTaskEvent) {
log.Log(log.ShimContext).Debug("Task retry timer initiated",
zap.String("appID", task.applicationID),
zap.String("TaskID", task.taskID),
zap.String("state", task.sm.Current()),
zap.Duration("timeout", timeout))

task.retryTimer = time.AfterFunc(timeout, task.timeoutRetryTimer(currentState, event))
}

func (task *Task) timeoutRetryTimer(expectedState string, event RetryTaskEvent) func() {
return func() {
task.lock.Lock()
defer task.lock.Unlock()
if expectedState == task.sm.Current() {
dispatcher.Dispatch(event)
}

}
}

func (task *Task) RetryThenFailTask(errorMessage, actionReason string) {
if task.attempt < task.retryNum {
log.Log(log.ShimCacheTask).Info("task failed, task will retrying", zap.String("taskID", task.taskID), zap.Int("attempt", task.attempt), zap.Int("retryNum", task.retryNum), zap.Duration("retryTimeInterval", task.retryTimeInterval), zap.String("errorMessage", errorMessage))
task.attempt++
task.setRetryTimer(task.retryTimeInterval, task.sm.Current(), NewRetryTaskEvent(task.applicationID, task.taskID, "retrying task"))
} else {
log.Log(log.ShimCacheTask).Error("task failed ", zap.String("taskID", task.taskID), zap.String("errorMessage", errorMessage))
task.failWithEvent(errorMessage, actionReason)
}
}

0 comments on commit 946c410

Please sign in to comment.