This is an automated email from the ASF dual-hosted git repository.

pbacsko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-core.git


The following commit(s) were added to refs/heads/master by this push:
     new ebf7107c [YUNIKORN-2237] Cleanup AggregateTrackedResource function 
(#749)
ebf7107c is described below

commit ebf7107cbef4844b06afaedf1b8d1630f81f8949
Author: targetoee <[email protected]>
AuthorDate: Wed Dec 6 14:17:23 2023 +0100

    [YUNIKORN-2237] Cleanup AggregateTrackedResource function (#749)
    
    Closes: #749
    
    Signed-off-by: Peter Bacsko <[email protected]>
---
 pkg/common/resources/tracked_resources.go | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/pkg/common/resources/tracked_resources.go 
b/pkg/common/resources/tracked_resources.go
index 209e1c11..313e67e0 100644
--- a/pkg/common/resources/tracked_resources.go
+++ b/pkg/common/resources/tracked_resources.go
@@ -98,12 +98,7 @@ func (tr *TrackedResource) AggregateTrackedResource(instType 
string,
                aggregatedResourceTime = map[string]int64{}
        }
        for key, element := range resource.Resources {
-               curUsage, ok := aggregatedResourceTime[key]
-               if !ok {
-                       curUsage = 0
-               }
-               curUsage += int64(element) * timeDiff // resource size times 
timeDiff
-               aggregatedResourceTime[key] = curUsage
+               aggregatedResourceTime[key] += int64(element) * timeDiff
        }
        tr.TrackedResourceMap[instType] = aggregatedResourceTime
 }


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

Reply via email to