From 946c41011138dec9dfd637def49b6b3fda58769d Mon Sep 17 00:00:00 2001 From: zhangjian16 Date: Thu, 24 Oct 2024 10:27:32 +0800 Subject: [PATCH] =?UTF-8?q?[YUNIKORN-2879]=20[shim]=20yunikorn=20unschedul?= =?UTF-8?q?able=20pods=20pending=20forever=20*=20task=20postfail=20or=20re?= =?UTF-8?q?jected=20reschedule=EE=9B=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/cache/task.go | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/pkg/cache/task.go b/pkg/cache/task.go index 9c85fed89..15839fd66 100644 --- a/pkg/cache/task.go +++ b/pkg/cache/task.go @@ -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) - } -}