CI / test (push) Successful in 9m40s
internal/control/slurmsvc tells each node what it is, writes slurm.conf and gres.conf from the nodes' reports and the inventory, and moves each node of slurm.nodes between llmgw and Slurm: lent, drained of replicas first, then resumed in Slurm; taken back, drained in Slurm and cordoned in llmgw until its last job step ends. Kept every tick from the settings and the agents' reports, so a new leader carries on. A broken Slurm never keeps a node from llmgw. GET /api/v1/slurm; ctl slurm status, setup, lend, reclaim, off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
29 lines
725 B
Go
29 lines
725 B
Go
package adminapi
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"gitea.mynodes.xyz/ilker/llmgw/internal/control/slurmsvc"
|
|
)
|
|
|
|
// SlurmService is the Slurm cluster beside llmgw (BACKLOG P), as the leader
|
|
// keeps it.
|
|
type SlurmService interface {
|
|
Status() slurmsvc.Status
|
|
}
|
|
|
|
// SetSlurm gives the API the Slurm service.
|
|
func (a *API) SetSlurm(s SlurmService) { a.slurm = s }
|
|
|
|
func (a *API) registerSlurm(mux Mux) {
|
|
mux.HandleFunc("GET /api/v1/slurm", a.slurmStatus)
|
|
}
|
|
|
|
func (a *API) slurmStatus(w http.ResponseWriter, _ *http.Request) {
|
|
if a.slurm == nil {
|
|
writeError(w, http.StatusNotImplemented, "Slurm needs the store and the nodes' agents, which this control plane runs without")
|
|
return
|
|
}
|
|
writeJSON(w, http.StatusOK, a.slurm.Status())
|
|
}
|