kingamarton commented on a change in pull request #267:
URL:
https://github.com/apache/incubator-yunikorn-k8shim/pull/267#discussion_r640710049
##########
File path: pkg/cache/task.go
##########
@@ -236,6 +238,36 @@ func (task *Task) isTerminated() bool {
return false
}
+// task object initialization
+// normally when task is added, the task state is New
+// but during recovery, we need to init the task state according to
+// the task pod status. if the pod is already terminated,
+// we should mark the task as completed according.
+func (task *Task) initialize() {
+ task.lock.Lock()
+ defer task.lock.Unlock()
+
+ // task needs recovery means the task has already been
+ // scheduled by us with an allocation, instead of starting
+ // from New, directly set the task to Allocated.
+ if utils.NeedRecovery(task.pod) {
+ log.Logger().Info("init allocated task")
Review comment:
Here in the log message we should include the at least the allocation
UID,for better troubleshooting
--
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]