This is an automated email from the ASF dual-hosted git repository. DImuthuUpe pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/airavata-custos.git
commit a73f07e32ed1e3a88e2068f3d100d3ea3b690055 Author: DImuthuUpe <[email protected]> AuthorDate: Mon May 25 20:33:12 2026 -0400 Adding qos to association --- .../SLURM/Association-Mapper/internal/operations/types.go | 6 ++++++ .../internal/subscribers/accountsub_integration_test.go | 6 +++--- .../SLURM/Association-Mapper/internal/subscribers/members.go | 2 ++ .../internal/subscribers/members_integration_test.go | 12 ++++++------ 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/connectors/SLURM/Association-Mapper/internal/operations/types.go b/connectors/SLURM/Association-Mapper/internal/operations/types.go index 75aaca6bd..e00e83d3f 100644 --- a/connectors/SLURM/Association-Mapper/internal/operations/types.go +++ b/connectors/SLURM/Association-Mapper/internal/operations/types.go @@ -43,6 +43,9 @@ type Association struct { ParentAccount string `json:"parent_account,omitempty"` IsDefault *bool `json:"is_default,omitempty"` ID int64 `json:"id_association,omitempty"` + // QoS is the list of QoS names permitted for this association + // (e.g. ["normal"]). Marshaled to the top-level `qos` field on the wire. + QoS []string `json:"-"` // Limits is a logical grouping — slurmrestd v0.0.41 actually encodes limits // in a nested `max` object per-association. We translate between the two // shapes in Marshal/UnmarshalJSON below. @@ -108,6 +111,7 @@ type assocWire struct { ParentAccount string `json:"parent_account,omitempty"` IsDefault *bool `json:"is_default,omitempty"` ID int64 `json:"id_association,omitempty"` + QoS []string `json:"qos,omitempty"` Max *assocMax `json:"max,omitempty"` } @@ -120,6 +124,7 @@ func (a Association) MarshalJSON() ([]byte, error) { ParentAccount: a.ParentAccount, IsDefault: a.IsDefault, ID: a.ID, + QoS: a.QoS, } m := &assocMax{} touched := false @@ -163,6 +168,7 @@ func (a *Association) UnmarshalJSON(data []byte) error { a.ParentAccount = w.ParentAccount a.IsDefault = w.IsDefault a.ID = w.ID + a.QoS = w.QoS a.Limits = AssocLimits{} if w.Max != nil { if w.Max.Jobs != nil && w.Max.Jobs.Per != nil { diff --git a/connectors/SLURM/Association-Mapper/internal/subscribers/accountsub_integration_test.go b/connectors/SLURM/Association-Mapper/internal/subscribers/accountsub_integration_test.go index 613d778bc..867f5ff29 100644 --- a/connectors/SLURM/Association-Mapper/internal/subscribers/accountsub_integration_test.go +++ b/connectors/SLURM/Association-Mapper/internal/subscribers/accountsub_integration_test.go @@ -219,7 +219,7 @@ func TestSubscribeToComputeAllocationResourceMappingCreation(t *testing.T) { clusterName := "artisan" projectID := "project-001" computeAllocationID := "compute-allocation-001" - computeAllocationName := "MD Allocation" + computeAllocationName := "md-allocation" partitionName := "compute" allocationResourceId := "allocation-resource-001" allocationMappingId := "allocation-mapping-001" @@ -289,7 +289,7 @@ func TestSubscribeToComputeAllocationResourceMappingWrongClusterCreation(t *test clusterName := "wrong_cluster_name" // this is intentionally wrong to simulate the error case projectID := "project-001" computeAllocationID := "compute-allocation-001" - computeAllocationName := "MD Allocation" + computeAllocationName := "md-allocation" partitionName := "compute" allocationResourceId := "allocation-resource-001" allocationMappingId := "allocation-mapping-001" @@ -363,7 +363,7 @@ func TestSubscribeToComputeAllocationResourceMappingWrongResourceTypeCreation(t clusterName := "artisan" projectID := "project-001" computeAllocationID := "compute-allocation-001" - computeAllocationName := "MD Allocation" + computeAllocationName := "md-allocation" partitionName := "compute" allocationResourceId := "allocation-resource-001" allocationMappingId := "allocation-mapping-001" diff --git a/connectors/SLURM/Association-Mapper/internal/subscribers/members.go b/connectors/SLURM/Association-Mapper/internal/subscribers/members.go index c36cfc453..1d8b294fd 100644 --- a/connectors/SLURM/Association-Mapper/internal/subscribers/members.go +++ b/connectors/SLURM/Association-Mapper/internal/subscribers/members.go @@ -62,6 +62,7 @@ func (a *AssociationSubscriber) SubscribeToComputeAllocationMembershipCreation( Cluster: cluster.Name, User: csu.LocalUsername, Partition: resources[0].Name, // TODO: do for each resource + QoS: []string{"normal"}, } err = a.slurmClient.UpsertAssociation(association) @@ -155,6 +156,7 @@ func (a *AssociationSubscriber) SubscribeToComputeAllocationMembershipResourceOv Cluster: cluster.Name, User: csu.LocalUsername, Partition: allocationResource.Name, + QoS: []string{"normal"}, Limits: limits, } diff --git a/connectors/SLURM/Association-Mapper/internal/subscribers/members_integration_test.go b/connectors/SLURM/Association-Mapper/internal/subscribers/members_integration_test.go index 7eae76ea0..3bd90837d 100644 --- a/connectors/SLURM/Association-Mapper/internal/subscribers/members_integration_test.go +++ b/connectors/SLURM/Association-Mapper/internal/subscribers/members_integration_test.go @@ -24,7 +24,7 @@ func TestSubscribeToComputeAllocationMembershipCreation(t *testing.T) { clusterID := "cluster-001" clusterName := "artisan" computeAllocationID := "compute-allocation-001" - computeAllocationName := "MD Allocation" + computeAllocationName := "md-allocation" partitionName := "compute" allocationResourceId := "allocation-resource-001" //allocationMappingId := "allocation-mapping-001" @@ -131,7 +131,7 @@ func TestSubscribeToComputeAllocationMembershipResourceOverrideCreation(t *testi clusterID := "cluster-001" clusterName := "artisan" computeAllocationID := "compute-allocation-001" - computeAllocationName := "MD Allocation" + computeAllocationName := "md-allocation" partitionName := "compute" allocationResourceId := "allocation-resource-001" //allocationMappingId := "allocation-mapping-001" @@ -152,13 +152,13 @@ func TestSubscribeToComputeAllocationMembershipResourceOverrideCreation(t *testi GrpTRES: []operations.TRES{ { Type: "cpu", - Count: 100, + Count: 10, }, }, GrpTRESMins: []operations.TRES{ { Type: "cpu", - Count: 1000, + Count: 2, }, }, }, @@ -227,8 +227,8 @@ func TestSubscribeToComputeAllocationMembershipResourceOverrideCreation(t *testi ID: "override-001", ComputeAllocationMembershipID: "membership-001", ComputeAllocationResourceID: allocationResourceId, - OverrideResourceAmount: 50, - OverrideResourceTime: 500, + OverrideResourceAmount: 1, + OverrideResourceTime: 1, } associationSubscriber := NewAssociationSubscriber(client, nil, mockCoreService)
