zhuqi-lucas commented on code in PR #895:
URL: https://github.com/apache/yunikorn-k8shim/pull/895#discussion_r1720638768
##########
pkg/cache/task.go:
##########
@@ -494,25 +494,32 @@ func (task *Task) releaseAllocation() {
zap.String("task", task.GetTaskState()),
zap.String("terminationType", task.terminationType))
- // The message depends on current task state, generate requests
accordingly.
- // If allocated send an AllocationReleaseRequest,
- // If not allocated yet send an AllocationAskReleaseRequest
+ // Send an AllocationReleaseRequest,
var releaseRequest *si.AllocationRequest
s := TaskStates()
- switch task.GetTaskState() {
- case s.New, s.Pending, s.Scheduling, s.Rejected:
- releaseRequest =
common.CreateReleaseRequestForTask(task.applicationID, task.taskID,
task.application.partition, task.terminationType)
- default:
+
+ // Check if the task is in a state where it has not been
allocated yet.
+ if task.GetTaskState() != s.New && task.GetTaskState() !=
s.Pending &&
+ task.GetTaskState() != s.Scheduling &&
task.GetTaskState() != s.Rejected {
+
+ // Task is in a state where it might have been
allocated.
if task.allocationKey == "" {
Review Comment:
One more question, do we need to log empty allocation key for those states
now? Or we need check for all states. cc @pbacsko @craigcondit @wilfred-s
--
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]