wilfred-s commented on code in PR #460:
URL: https://github.com/apache/yunikorn-core/pull/460#discussion_r1036632248


##########
pkg/scheduler/ugm/group_tracker.go:
##########
@@ -65,7 +65,13 @@ func (gt *GroupTracker) getTrackedApplications() 
map[string]bool {
        return gt.applications
 }
 
-func (gt *GroupTracker) getGroupResourceUsageDAOInfo(queueTracker 
*QueueTracker) *dao.GroupResourceUsageDAOInfo {
+func (gt *GroupTracker) GetGroupRootQueueTracker() *QueueTracker {
+       gt.RLock()
+       defer gt.RUnlock()
+       return gt.queueTracker
+}
+
+func (gt *GroupTracker) GetGroupResourceUsageDAOInfo(queueTracker 
*QueueTracker) *dao.GroupResourceUsageDAOInfo {

Review Comment:
   We do not use `queueTracker` and should not pass it in.



##########
pkg/scheduler/ugm/user_tracker.go:
##########
@@ -84,7 +84,13 @@ func (ut *UserTracker) getTrackedApplications() 
map[string]*GroupTracker {
        return ut.appGroupTrackers
 }
 
-func (ut *UserTracker) getUserResourceUsageDAOInfo(queueTracker *QueueTracker) 
*dao.UserResourceUsageDAOInfo {
+func (ut *UserTracker) GetUserRootQueueTracker() *QueueTracker {
+       ut.RLock()
+       defer ut.RUnlock()
+       return ut.queueTracker
+}

Review Comment:
   Exposing the queue outside of its context is dangerous.
   We must not do this.



##########
pkg/scheduler/ugm/group_tracker.go:
##########
@@ -65,7 +65,13 @@ func (gt *GroupTracker) getTrackedApplications() 
map[string]bool {
        return gt.applications
 }
 
-func (gt *GroupTracker) getGroupResourceUsageDAOInfo(queueTracker 
*QueueTracker) *dao.GroupResourceUsageDAOInfo {
+func (gt *GroupTracker) GetGroupRootQueueTracker() *QueueTracker {
+       gt.RLock()
+       defer gt.RUnlock()
+       return gt.queueTracker
+}

Review Comment:
   Exposing the queue outside of its context is dangerous.
   We must not do this.



##########
pkg/scheduler/ugm/user_tracker.go:
##########
@@ -84,7 +84,13 @@ func (ut *UserTracker) getTrackedApplications() 
map[string]*GroupTracker {
        return ut.appGroupTrackers
 }
 
-func (ut *UserTracker) getUserResourceUsageDAOInfo(queueTracker *QueueTracker) 
*dao.UserResourceUsageDAOInfo {
+func (ut *UserTracker) GetUserRootQueueTracker() *QueueTracker {
+       ut.RLock()
+       defer ut.RUnlock()
+       return ut.queueTracker
+}
+
+func (ut *UserTracker) GetUserResourceUsageDAOInfo(queueTracker *QueueTracker) 
*dao.UserResourceUsageDAOInfo {

Review Comment:
   We do not use `queueTracker` and should not pass it in.



-- 
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]

Reply via email to