This is an automated email from the ASF dual-hosted git repository.

pbacsko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 7a1633a4 [YUNIKORN-2759] Replace %w by Errors.join (#921)
7a1633a4 is described below

commit 7a1633a4d3a0f8e04244c1121c208e6ed88cb0d2
Author: Hsien-Cheng(Ryan) Huang <[email protected]>
AuthorDate: Fri Jul 26 14:42:19 2024 +0200

    [YUNIKORN-2759] Replace %w by Errors.join (#921)
    
    Closes: #921
    
    Signed-off-by: Peter Bacsko <[email protected]>
---
 pkg/scheduler/context.go       | 3 ++-
 pkg/scheduler/objects/queue.go | 6 +++---
 pkg/scheduler/ugm/manager.go   | 3 ++-
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/pkg/scheduler/context.go b/pkg/scheduler/context.go
index f5329c22..918579f5 100644
--- a/pkg/scheduler/context.go
+++ b/pkg/scheduler/context.go
@@ -19,6 +19,7 @@
 package scheduler
 
 import (
+       "errors"
        "fmt"
        "math"
        "time"
@@ -610,7 +611,7 @@ func (cc *ClusterContext) addNode(nodeInfo *si.NodeInfo, 
schedulable bool) error
        err := partition.AddNode(sn, existingAllocations)
        sn.SendNodeAddedEvent()
        if err != nil {
-               wrapped := fmt.Errorf("failure while adding new node, node 
rejected with error: %w", err)
+               wrapped := errors.Join(errors.New("failure while adding new 
node, node rejected with error: "), err)
                log.Log(log.SchedContext).Error("Failed to add node to 
partition (rejected)",
                        zap.String("nodeID", sn.NodeID),
                        zap.String("partitionName", sn.Partition),
diff --git a/pkg/scheduler/objects/queue.go b/pkg/scheduler/objects/queue.go
index f6b92c58..d3816028 100644
--- a/pkg/scheduler/objects/queue.go
+++ b/pkg/scheduler/objects/queue.go
@@ -125,7 +125,7 @@ func NewConfiguredQueue(conf configs.QueueConfig, parent 
*Queue) (*Queue, error)
 
        // update the properties
        if err := sq.applyConf(conf); err != nil {
-               return nil, fmt.Errorf("configured queue creation failed: %w", 
err)
+               return nil, errors.Join(errors.New("configured queue creation 
failed: "), err)
        }
 
        // add to the parent, we might have an overall lock already
@@ -137,7 +137,7 @@ func NewConfiguredQueue(conf configs.QueueConfig, parent 
*Queue) (*Queue, error)
                sq.QueuePath = parent.QueuePath + configs.DOT + sq.Name
                err := parent.addChildQueue(sq)
                if err != nil {
-                       return nil, fmt.Errorf("configured queue creation 
failed: %w", err)
+                       return nil, errors.Join(errors.New("configured queue 
creation failed: "), err)
                }
        } else {
                sq.UpdateQueueProperties()
@@ -199,7 +199,7 @@ func newDynamicQueueInternal(name string, leaf bool, parent 
*Queue) (*Queue, err
        // still need to make sure we lock the parent so we do not interfere 
with scheduling
        err := parent.addChildQueue(sq)
        if err != nil {
-               return nil, fmt.Errorf("dynamic queue creation failed: %w", err)
+               return nil, errors.Join(errors.New("dynamic queue creation 
failed: "), err)
        }
 
        sq.UpdateQueueProperties()
diff --git a/pkg/scheduler/ugm/manager.go b/pkg/scheduler/ugm/manager.go
index 8d67b9bd..4824038e 100644
--- a/pkg/scheduler/ugm/manager.go
+++ b/pkg/scheduler/ugm/manager.go
@@ -19,6 +19,7 @@
 package ugm
 
 import (
+       "errors"
        "fmt"
        "strings"
        "sync"
@@ -338,7 +339,7 @@ func (m *Manager) internalProcessConfig(cur 
configs.QueueConfig, queuePath strin
                                zap.String("queue path", queuePath),
                                zap.Any("limit max resources", 
limit.MaxResources),
                                zap.Error(err))
-                       return fmt.Errorf("problem in using the max resources 
settings for queuepath: %s. reason: %w", queuePath, err)
+                       return errors.Join(fmt.Errorf("problem in using the max 
resources settings for queuepath: %s, reason: ", queuePath), err)
                }
                limitConfig := &LimitConfig{maxResources: maxResource, 
maxApplications: limit.MaxApplications}
                for _, user := range limit.Users {


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

Reply via email to