Skip to content

Commit

Permalink
Now simpler
Browse files Browse the repository at this point in the history
Signed-off-by: Rafael Raposo <[email protected]>
  • Loading branch information
RRap0so committed Mar 4, 2024
1 parent c661e0b commit f53c866
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions flyteadmin/pkg/executioncluster/impl/random_cluster_selector.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,24 +106,22 @@ func (s RandomClusterSelector) GetTarget(ctx context.Context, spec *executionclu

var weightedRandomList random.WeightedRandomList

var label string

if spec.ClusterAssignment != nil && spec.ClusterAssignment.ExecutionClusterLabelName != "" {
label := spec.ClusterAssignment.ExecutionClusterLabelName
label = spec.ClusterAssignment.ExecutionClusterLabelName
} else if resource != nil && resource.Attributes.GetExecutionClusterLabel() != nil {
label = resource.Attributes.GetExecutionClusterLabel().Value
}

if label != "" {
if _, ok := s.labelWeightedRandomMap[label]; ok {
weightedRandomList = s.labelWeightedRandomMap[label]
}
} else {
if resource != nil && resource.Attributes.GetExecutionClusterLabel() != nil {
label := resource.Attributes.GetExecutionClusterLabel().Value

if _, ok := s.labelWeightedRandomMap[label]; ok {
weightedRandomList = s.labelWeightedRandomMap[label]
} else {
logger.Debugf(ctx, "No cluster mapping found for the label %s", label)
}
} else {
logger.Debugf(ctx, "No override found for the spec %v", spec)
logger.Debugf(ctx, "No cluster mapping found for the label %s", label)
}
} else {
logger.Debugf(ctx, "No override found for the spec %v", spec)
}

if weightedRandomList == nil {
Expand Down

0 comments on commit f53c866

Please sign in to comment.