[ 
https://issues.apache.org/jira/browse/YUNIKORN-1238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17555389#comment-17555389
 ] 

Wilfred Spiegelenburg commented on YUNIKORN-1238:
-------------------------------------------------

I looked at the change. There is nothing wrong with the change in itself.

However: we cannot add a node to a partition if the partition does not exist. 
The node sorting policy is set as part of the partition creation. This is 
called from the cluster context for new and updated configurations. Which means 
that we can never really have a nil policy in a non test setup.

This is the call tree, we always go through the PartitionContext and update the 
policy:
{code:java}
*baseNodeCollection.SetNodeSortingPolicy in 
github.com/apache/yunikorn-core/pkg/scheduler/objects/node_collection.go
    *PartitionContext.updateNodeSortingPolicy in 
github.com/apache/yunikorn-core/pkg/scheduler/partition.go
        *PartitionContext.initialPartitionFromConfig in 
github.com/apache/yunikorn-core/pkg/scheduler/partition.go
            newPartitionContext in 
github.com/apache/yunikorn-core/pkg/scheduler/partition.go
                *ClusterContext.updateSchedulerConfig (2 usages) in 
github.com/apache/yunikorn-core/pkg/scheduler/context.go
                    *ClusterContext.UpdateRMSchedulerConfig in 
github.com/apache/yunikorn-core/pkg/scheduler/context.go
                    *ClusterContext.UpdateSchedulerConfig in 
github.com/apache/yunikorn-core/pkg/scheduler/context.go
                    *ClusterContext.processRMConfigUpdateEvent in 
github.com/apache/yunikorn-core/pkg/scheduler/context.go
                    *ClusterContext.processRMRegistrationEvent in 
github.com/apache/yunikorn-core/pkg/scheduler/context.go
        *PartitionContext.updatePartitionDetails in 
github.com/apache/yunikorn-core/pkg/scheduler/partition.go
            *ClusterContext.updateSchedulerConfig in 
github.com/apache/yunikorn-core/pkg/scheduler/context.go
                *ClusterContext.UpdateSchedulerConfig in 
github.com/apache/yunikorn-core/pkg/scheduler/context.go
                *ClusterContext.processRMRegistrationEvent in 
github.com/apache/yunikorn-core/pkg/scheduler/context.go
                *ClusterContext.processRMConfigUpdateEvent in 
github.com/apache/yunikorn-core/pkg/scheduler/context.go
                *ClusterContext.UpdateRMSchedulerConfig in 
github.com/apache/yunikorn-core/pkg/scheduler/context.go{code}
The defaulting is also handled, indirectly, in the 
{{PartitionContext.updateNodeSortingPolicy}} call. This allows us to change the 
default policy in one place, the policy definition, without making any other 
code changes.

The checks for a nil policy in the two calls in the partition (i.e. 
{{GetNodeSortingPolicyType()}} and {{GetNodeSortingResourceWeights()}} seem 
redundant but it is always better to be safe than sorry.

> Setting fair node policy instead of nil is in NewNodeCollection
> ---------------------------------------------------------------
>
>                 Key: YUNIKORN-1238
>                 URL: https://issues.apache.org/jira/browse/YUNIKORN-1238
>             Project: Apache YuniKorn
>          Issue Type: Improvement
>          Components: core - scheduler
>            Reporter: Chen Yu Teng
>            Assignee: Chen Yu Teng
>            Priority: Minor
>              Labels: pull-request-available
>
> We can set node sorting policy with fair policy when partition called 
> NewNodeCollection function.
> In [nodeCollection level|#L228-L235], the node sorting policy is nil and the 
> order of nodes in nodeCollection is the time adding node. If partition call 
> nodes.GetNodeSortingPolicy() which is nil, nil will be treated as fair 
> although the behavior of node sorting is not the behavior with fair 
> policy([code|#L1449-L1457]).
> In partition level,  original flow will be like.
>  # Creates nodeCollection that node sorting policy is nil([code|#L95])
>  # In updateNodeSortingPolicy function, partition updates related fields from 
> config. If policy in config is empty , SortingPolicyFromString function will 
> return fair policy, partition update node sorting policy by 
> nodes.SetNodeSortingPolicy(fair policy)
> I want to modify the node sorting policy in 1 step and set the default node 
> sorting policy is fair policy.
>  



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

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

Reply via email to