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

lahirujayathilake pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-custos.git


The following commit(s) were added to refs/heads/master by this push:
     new f7851d068 Fix Slurm reconciler abort (#688)
f7851d068 is described below

commit f7851d068fb79191b837cf861e2ea9aa38a190e2
Author: Yasith Jayawardana <[email protected]>
AuthorDate: Thu Nov 5 16:00:12 2026 -0500

    Fix Slurm reconciler abort (#688)
---
 .../internal/subscribers/members_test.go           | 31 ++++++++++++++++++++++
 .../internal/subscribers/reconciler.go             |  4 +++
 2 files changed, 35 insertions(+)

diff --git 
a/connectors/SLURM/Association-Mapper/internal/subscribers/members_test.go 
b/connectors/SLURM/Association-Mapper/internal/subscribers/members_test.go
index 0db792566..acbaf3364 100644
--- a/connectors/SLURM/Association-Mapper/internal/subscribers/members_test.go
+++ b/connectors/SLURM/Association-Mapper/internal/subscribers/members_test.go
@@ -391,6 +391,37 @@ func 
TestReconcilerWritesAssociationsForProvisionedMembers(t *testing.T) {
        }
 }
 
+// A member with no account on another cluster must not stop this cluster's 
pass.
+func TestReconcilerSkipsMembershipsOnUnprovisionedClusters(t *testing.T) {
+       elsewhere := models.ComputeAllocationMembership{
+               ID: "mem-2", ComputeAllocationID: "alloc-2", UserID: "user-1", 
MembershipStatus: models.ACTIVE,
+       }
+       core := coreMock(mockOpts{
+               provisionedAt: ago(time.Minute),
+               memberships:   []models.ComputeAllocationMembership{elsewhere, 
testMembership()},
+       })
+       getAllocation, getAccount := core.GetComputeAllocationFunc, 
core.GetComputeClusterUserByPairFunc
+       core.GetComputeAllocationFunc = func(ctx context.Context, id string) 
(*models.ComputeAllocation, error) {
+               alloc, err := getAllocation(ctx, id)
+               if id == "alloc-2" {
+                       alloc.ComputeClusterID = "cluster-2"
+               }
+               return alloc, err
+       }
+       core.GetComputeClusterUserByPairFunc = func(ctx context.Context, 
clusterID, userID string) (*models.ComputeClusterUser, error) {
+               if clusterID == "cluster-2" {
+                       return nil, service.ErrNotFound
+               }
+               return getAccount(ctx, clusterID, userID)
+       }
+       slurm := &fakeSlurmClient{}
+       NewAssociationSubscriber(slurm, nil, core, 0, 
0).reconcile(context.Background())
+
+       if n := len(slurm.all()); n != 1 {
+               t.Fatalf("expected the provisioned cluster's association, got 
%d", n)
+       }
+}
+
 func TestReconcilerSkipsUnprovisionedAndTooFreshAccounts(t *testing.T) {
        cases := map[string]*time.Time{
                "never provisioned": nil,
diff --git 
a/connectors/SLURM/Association-Mapper/internal/subscribers/reconciler.go 
b/connectors/SLURM/Association-Mapper/internal/subscribers/reconciler.go
index f5884813e..99baaf55b 100644
--- a/connectors/SLURM/Association-Mapper/internal/subscribers/reconciler.go
+++ b/connectors/SLURM/Association-Mapper/internal/subscribers/reconciler.go
@@ -19,6 +19,7 @@ package subscribers
 
 import (
        "context"
+       "errors"
        "log/slog"
        "time"
 
@@ -128,6 +129,9 @@ func (a *AssociationSubscriber) reconcileCluster(ctx 
context.Context, cluster mo
                                continue
                        }
                        record, err := a.desiredAssociationForMembership(ctx, 
membership)
+                       if errors.Is(err, errNotProvisioned) {
+                               continue
+                       }
                        if err != nil {
                                slog.ErrorContext(ctx, "Association reconciler: 
failed to resolve desired association",
                                        "membership_id", membership.ID, 
"error", err)

Reply via email to