slurm

package
v0.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2026 License: GPL-3.0, LGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package slurm handles Slurm version discovery and configuration generation.

Index

Constants

View Source
const (
	ConfDir       = "/etc/slurm"
	NodesConfFile = "sind-nodes.conf"
	NodesConfPath = ConfDir + "/" + NodesConfFile
)

Container paths for Slurm configuration files.

View Source
const (
	MungeDir     = "/etc/munge"
	MungeKeyFile = "munge.key"
	MungeKeyPath = MungeDir + "/" + MungeKeyFile
)

Container paths for munge configuration.

View Source
const MungeKeySize = 128

MungeKeySize is the default munge key size in bytes (1024 bits), matching the mungekey --create default.

Variables

This section is empty.

Functions

func AddNodesToConf

func AddNodesToConf(existing string, nodes []NodeEntry) string

AddNodesToConf adds node definitions to existing sind-nodes.conf content. New NodeName lines are inserted and the PartitionName Nodes= list is updated to include both existing and new nodes.

func DiscoverVersion

func DiscoverVersion(ctx context.Context, dc *docker.Client, image string, pull bool) (string, error)

DiscoverVersion runs slurmctld -V in an ephemeral container and returns the Slurm version string (e.g. "25.11.0"). When pull is true, the image is always pulled before running the container.

func GenerateCgroupConf

func GenerateCgroupConf(cgroup config.Section) string

GenerateCgroupConf generates the cgroup.conf content for cgroupv2 support. The cgroup section can append content (string form) or include a .conf.d directory (map form).

func GenerateMungeKey

func GenerateMungeKey() []byte

GenerateMungeKey generates a random munge authentication key.

func GenerateNodesConf

func GenerateNodesConf(nodes []config.Node) string

GenerateNodesConf generates the sind-nodes.conf content with NodeName and PartitionName directives. Only managed worker nodes are included. Non-worker nodes and unmanaged worker nodes are skipped.

func GeneratePlugstackConf added in v0.7.0

func GeneratePlugstackConf(plugstack config.Section) string

GeneratePlugstackConf generates the plugstack.conf content. Always includes the .conf.d directory for fragment support.

func GenerateSectionConf added in v0.7.0

func GenerateSectionConf(name string, section config.Section) string

GenerateSectionConf generates the content for a standalone config file (gres.conf, topology.conf). String form returns content directly; map form returns include lines for each fragment file.

func GenerateSlurmConf

func GenerateSlurmConf(clusterName string, main config.Section) string

GenerateSlurmConf generates the main slurm.conf content for a cluster. Node definitions are not included here; they go in sind-nodes.conf. The main section can append content (string form) or include a .conf.d directory (map form).

func ParseMemoryMB

func ParseMemoryMB(s string) (int, error)

ParseMemoryMB parses a Docker-style memory string (e.g. "2g", "512m") and returns the value in megabytes.

func RemoveNodesFromConf

func RemoveNodesFromConf(existing string, names []string) string

RemoveNodesFromConf removes the named nodes from existing sind-nodes.conf content. NodeName lines for the removed nodes are deleted and the PartitionName Nodes= list is updated.

Types

type NodeEntry

type NodeEntry struct {
	Name     string
	CPUs     int
	MemoryMB int
}

NodeEntry represents a single node to add to sind-nodes.conf.

type Service added in v0.7.0

type Service string

Service identifies a Slurm daemon managed by sind.

const (
	Slurmctld Service = "slurmctld"
	Slurmd    Service = "slurmd"
)

Slurm daemon services.

func ServiceForRole added in v0.7.0

func ServiceForRole(role config.Role) (Service, bool)

ServiceForRole returns the Slurm service for the given node role. Returns empty string and false for roles that have no Slurm service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL