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 2022/12/01 03:26:46 UTC

[GitHub] [yunikorn-core] wilfred-s commented on a diff in pull request #460: [YUNIKORN-1330] Expose REST API's

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: reviews-unsubscribe@yunikorn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org