You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@yunikorn.apache.org by GitBox <gi...@apache.org> on 2021/06/01 21:54:21 UTC

[GitHub] [incubator-yunikorn-k8shim] yangwwei commented on a change in pull request #267: [YUNIKORN-686] [Regression] Placeholders for completed applications are recreated during recovery

yangwwei commented on a change in pull request #267:
URL: https://github.com/apache/incubator-yunikorn-k8shim/pull/267#discussion_r643504680



##########
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:
       Added some more logs




-- 
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:
users@infra.apache.org