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

DImuthuUpe pushed a commit to branch slurm-mapper-int
in repository https://gitbox.apache.org/repos/asf/airavata-custos.git

commit 7ea76163d935a9e1def14f03652aba7cd364d1ae
Author: DImuthuUpe <[email protected]>
AuthorDate: Mon May 18 00:38:34 2026 -0400

    Initial framework in integrate connectors to core with pub sub
---
 cmd/server/main.go                                 |  5 +++
 connectors/SLURM/Association-Mapper/Makefile       | 18 ----------
 connectors/SLURM/Association-Mapper/README.md      | 42 +++++-----------------
 connectors/SLURM/Association-Mapper/go.mod         |  3 --
 .../internal/subscribers/account.go                | 16 +++++++++
 .../internal/subscribers/subscriber.go             | 22 ++++++++++++
 connectors/SLURM/Association-Mapper/main.go        | 25 -------------
 .../SLURM/Association-Mapper/pkg/smapper/loader.go | 11 ++++++
 internal/connectors/loader.go                      | 20 +++++++++++
 9 files changed, 82 insertions(+), 80 deletions(-)

diff --git a/cmd/server/main.go b/cmd/server/main.go
index 978d5cc92..ea0ebd697 100644
--- a/cmd/server/main.go
+++ b/cmd/server/main.go
@@ -29,6 +29,7 @@ import (
        "syscall"
        "time"
 
+       "github.com/apache/airavata-custos/internal/connectors"
        "github.com/apache/airavata-custos/internal/db"
        "github.com/apache/airavata-custos/internal/server"
        "github.com/apache/airavata-custos/pkg/events"
@@ -72,6 +73,10 @@ func run() error {
        // Create a new event bus instance to async messaging between service 
and connectors
        eventBus := events.New()
 
+       if err := connectors.LoadConnectors(eventBus); err != nil {
+               return err
+       }
+
        svc := service.New(database, eventBus)
        handler := server.LoggingMiddleware(server.New(svc))
 
diff --git a/connectors/SLURM/Association-Mapper/Makefile 
b/connectors/SLURM/Association-Mapper/Makefile
deleted file mode 100644
index 32efab927..000000000
--- a/connectors/SLURM/Association-Mapper/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-.PHONY: build test run tidy clean
-
-BIN := bin/association-mapper
-
-build:
-       go build -o $(BIN) .
-
-run: build
-       ./$(BIN)
-
-test:
-       go test ./...
-
-tidy:
-       go mod tidy
-
-clean:
-       rm -rf bin
diff --git a/connectors/SLURM/Association-Mapper/README.md 
b/connectors/SLURM/Association-Mapper/README.md
index 667af800f..9d9bfc6f0 100644
--- a/connectors/SLURM/Association-Mapper/README.md
+++ b/connectors/SLURM/Association-Mapper/README.md
@@ -2,6 +2,8 @@
 
 SLURM association creation logic lives in this plugin. It is triggered when 
the allocation manager has processed an allocation request and released it to 
downstream handlers. It talks to `slurmrestd` to manage accounts, associations, 
and TRES limits.
 
+This package is part of the root `github.com/apache/airavata-custos` module.
+
 ## Prerequisites
 
 - Go **1.24+**
@@ -11,46 +13,18 @@ SLURM association creation logic lives in this plugin. It 
is triggered when the
 
 ```
 .
-├── main.go                       # entry point
-├── internal/operations/          # slurmrestd client + 
accounts/associations/TRES
-├── go.mod
-└── Makefile
-```
-
-Module path: 
`github.com/apache/airavata-custos/connectors/SLURM/Association-Mapper`.
-
-## Build
-
-```bash
-# from this directory
-make build           # produces bin/association-mapper
-# or directly:
-go build -o bin/association-mapper .
+├── internal/operations/   # slurmrestd client + accounts/associations/TRES
+└── pkg/operations/
 ```
 
-## Run
-
-```bash
-make run             # build, then ./bin/association-mapper
-```
-
-The service starts, logs `association-mapper started`, and blocks until it 
receives `SIGINT` or `SIGTERM`.
+Import path: 
`github.com/apache/airavata-custos/connectors/SLURM/Association-Mapper/internal/operations`.
 
 ## Test
 
 ```bash
-make test            # go test ./...
-go vet ./...         # static checks
+# from the repository root
+go test ./connectors/SLURM/Association-Mapper/...
+go vet ./connectors/SLURM/Association-Mapper/...
 ```
 
 Tests are hermetic and use `httptest` — no live `slurmrestd` required.
-
-## Common make targets
-
-| Target  | Description                          |
-|---------|--------------------------------------|
-| `build` | Compile the binary into `bin/`       |
-| `run`   | Build and run                        |
-| `test`  | Run all unit tests                   |
-| `tidy`  | `go mod tidy`                        |
-| `clean` | Remove `bin/`                        |
diff --git a/connectors/SLURM/Association-Mapper/go.mod 
b/connectors/SLURM/Association-Mapper/go.mod
deleted file mode 100644
index 0e1832e7c..000000000
--- a/connectors/SLURM/Association-Mapper/go.mod
+++ /dev/null
@@ -1,3 +0,0 @@
-module github.com/apache/airavata-custos/connectors/SLURM/Association-Mapper
-
-go 1.24.0
diff --git 
a/connectors/SLURM/Association-Mapper/internal/subscribers/account.go 
b/connectors/SLURM/Association-Mapper/internal/subscribers/account.go
new file mode 100644
index 000000000..9c2f29c6f
--- /dev/null
+++ b/connectors/SLURM/Association-Mapper/internal/subscribers/account.go
@@ -0,0 +1,16 @@
+package subscribers
+
+import "github.com/apache/airavata-custos/pkg/models"
+import "log/slog"
+
+func (a *AssociationSubscriber) 
SubscribeToComputeAccountCreation(computeAccount models.ComputeAllocation) {
+       slog.Info("Received compute account creation event", "account", 
computeAccount)
+}
+
+func (a *AssociationSubscriber) 
SubscribeToComputeAccountDeletion(computeAccount models.ComputeAllocation) {
+       slog.Info("Received compute account deletion event", "account", 
computeAccount)
+}
+
+func (a *AssociationSubscriber) SubscribeToComputeAccountUpdate(computeAccount 
models.ComputeAllocation) {
+       slog.Info("Received compute account update event", "account", 
computeAccount)
+}
diff --git 
a/connectors/SLURM/Association-Mapper/internal/subscribers/subscriber.go 
b/connectors/SLURM/Association-Mapper/internal/subscribers/subscriber.go
new file mode 100644
index 000000000..129bfcff9
--- /dev/null
+++ b/connectors/SLURM/Association-Mapper/internal/subscribers/subscriber.go
@@ -0,0 +1,22 @@
+package subscribers
+
+import client 
"github.com/apache/airavata-custos/connectors/SLURM/Association-Mapper/internal/operations"
+import "github.com/apache/airavata-custos/pkg/events"
+
+type AssociationSubscriber struct {
+       slurmClient *client.Client
+       eventBus    *events.Bus
+}
+
+func NewAssociationSubscriber(slurmClient *client.Client, eventBus 
*events.Bus) *AssociationSubscriber {
+       return &AssociationSubscriber{
+               slurmClient: slurmClient,
+               eventBus:    eventBus,
+       }
+}
+
+func (a *AssociationSubscriber) RegisterSubscribers() {
+       
a.eventBus.SubscribeComputeAllocationCreated(a.SubscribeToComputeAccountCreation)
+       
a.eventBus.SubscribeComputeAllocationDeleted(a.SubscribeToComputeAccountDeletion)
+       
a.eventBus.SubscribeComputeAllocationUpdated(a.SubscribeToComputeAccountUpdate)
+}
diff --git a/connectors/SLURM/Association-Mapper/main.go 
b/connectors/SLURM/Association-Mapper/main.go
deleted file mode 100644
index d04dcad1e..000000000
--- a/connectors/SLURM/Association-Mapper/main.go
+++ /dev/null
@@ -1,25 +0,0 @@
-// Package main is the entry point for the SLURM Association-Mapper connector.
-//
-// It consumes allocation events released by the allocation manager and
-// materializes them as SLURM associations via slurmrestd.
-package main
-
-import (
-       "context"
-       "log/slog"
-       "os"
-       "os/signal"
-       "syscall"
-)
-
-func main() {
-       logger := slog.New(slog.NewTextHandler(os.Stdout, 
&slog.HandlerOptions{Level: slog.LevelInfo}))
-       slog.SetDefault(logger)
-
-       ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, 
syscall.SIGTERM)
-       defer stop()
-
-       logger.Info("association-mapper started")
-       <-ctx.Done()
-       logger.Info("association-mapper stopped")
-}
diff --git a/connectors/SLURM/Association-Mapper/pkg/smapper/loader.go 
b/connectors/SLURM/Association-Mapper/pkg/smapper/loader.go
new file mode 100644
index 000000000..9c172b4f8
--- /dev/null
+++ b/connectors/SLURM/Association-Mapper/pkg/smapper/loader.go
@@ -0,0 +1,11 @@
+package smapper
+
+import "github.com/apache/airavata-custos/pkg/events"
+import 
"github.com/apache/airavata-custos/connectors/SLURM/Association-Mapper/internal/subscribers"
+import client 
"github.com/apache/airavata-custos/connectors/SLURM/Association-Mapper/internal/operations"
+
+func LoadConnector(eventBus *events.Bus) error {
+       slurmClient := client.New("localhost:8080", "", "") // Replace with 
actual SLURM client initialization.
+       subscribers.NewAssociationSubscriber(slurmClient, 
eventBus).RegisterSubscribers()
+       return nil
+}
diff --git a/internal/connectors/loader.go b/internal/connectors/loader.go
new file mode 100644
index 000000000..1b603abd1
--- /dev/null
+++ b/internal/connectors/loader.go
@@ -0,0 +1,20 @@
+package connectors
+
+import 
"github.com/apache/airavata-custos/connectors/SLURM/Association-Mapper/pkg/smapper"
+import "github.com/apache/airavata-custos/pkg/events"
+import "log/slog"
+
+func LoadConnectors(eventBus *events.Bus) error {
+
+       slog.Info("loading connectors")
+
+       slog.Info("loading SLURM Association Mapper connector")
+       err := smapper.LoadConnector(eventBus)
+       if err != nil {
+               slog.Error("failed to load SLURM Association Mapper connector", 
"error", err)
+               return err
+       }
+
+       slog.Info("finished loading connectors")
+       return err
+}

Reply via email to