Peter Bacsko created YUNIKORN-2220:
--------------------------------------

             Summary: pod.DeepCopy() is called twice in Task
                 Key: YUNIKORN-2220
                 URL: https://issues.apache.org/jira/browse/YUNIKORN-2220
             Project: Apache YuniKorn
          Issue Type: Improvement
          Components: shim - kubernetes
            Reporter: Peter Bacsko


A small improvement is possible in {{task.go}}.

In {{handleSubmitTaskEvent()}} and {{{}postTaskAllocated(){}}}, we call 
{{pod.DeepCopy()}} twice to avoid possible race conditions, but it's not 
needed. Once we have a copy, it's local to the method.

{noformat}
events.GetRecorder().Eventf(task.pod.DeepCopy(), nil, v1.EventTypeNormal, 
"Scheduling", "Scheduling",
                "%s is queued and waiting for allocation", task.alias)
        // if this task belongs to a task group, that means the app has gang 
scheduling enabled
        // in this case, post an event to indicate the task is being gang 
scheduled
        if !task.placeholder && task.taskGroupName != "" {
                events.GetRecorder().Eventf(task.pod.DeepCopy(), nil,
                        v1.EventTypeNormal, "GangScheduling", "GangScheduling",
                        "Pod belongs to the taskGroup %s, it will be scheduled 
as a gang member", task.taskGroupName) <-- second copy if GS is used
        }
{noformat}

{noformat}
events.GetRecorder().Eventf(task.pod.DeepCopy(),
        nil, v1.EventTypeNormal, "Scheduled", "Scheduled",
        "Successfully assigned %s to node %s", task.alias, task.nodeName)
...
events.GetRecorder().Eventf(task.pod.DeepCopy(), nil,
        v1.EventTypeNormal, "PodBindSuccessful", "PodBindSuccessful",
        "Pod %s is successfully bound to node %s", task.alias, task.nodeName)
{noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to