You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@yunikorn.apache.org by GitBox <gi...@apache.org> on 2020/03/25 12:52:51 UTC

[GitHub] [incubator-yunikorn-core] wilfred-s commented on a change in pull request #108: [YUNIKORN-47] Support node update action

wilfred-s commented on a change in pull request #108: [YUNIKORN-47] Support node update action
URL: https://github.com/apache/incubator-yunikorn-core/pull/108#discussion_r397786337
 
 

 ##########
 File path: pkg/scheduler/scheduling_node.go
 ##########
 @@ -74,13 +74,28 @@ func (sn *SchedulingNode) GetReservations() []string {
 	return keys
 }
 
+func (sn *SchedulingNode) updateNodeInfo(newNodeInfo *cache.NodeInfo) {
+	sn.Lock()
+	defer sn.Unlock()
+
+	sn.nodeInfo = newNodeInfo
+	sn.cachedAvailableUpdateNeeded = true
+}
+
 // Get the allocated resource on this node.
 // These resources are just the confirmed allocations (tracked in the cache node).
 // This does not lock the cache node as it will take its own lock.
 func (sn *SchedulingNode) GetAllocatedResource() *resources.Resource {
+	sn.RLock()
+	defer sn.RUnlock()
 	return sn.nodeInfo.GetAllocatedResource()
 }
 
+// expose this for tests
+func (sn *SchedulingNode) GetAvailableResourceForTest() *resources.Resource {
+	return sn.getAvailableResource()
+}
+
 
 Review comment:
   I would prefer we export `GetAvailableResource()`
   The major use is in the unit tests already so it is not really clear that this is purely for the smoke tests.
   We can do this in a follow up jira but we should try and get this in for 0.8

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@yunikorn.apache.org
For additional commands, e-mail: dev-help@yunikorn.apache.org