Getting Started#
Note
seamm_slurm is now a compatibility shim. Its code moved to
seamm_scheduler, which also supports PBS; everything below still works
through the same imports, but new code should use seamm_scheduler.
seamm_slurm wraps the SLURM command-line tools (sbatch, squeue,
sacct, scancel) behind one interface, SlurmBackend, with two
transports – LocalSlurm (SLURM CLI on the current host) and
SshSlurm (SLURM CLI on a remote host over passwordless SSH). It has no
SEAMM-core dependency and no notion of SEAMM’s own job-status vocabulary; it
only speaks SLURM’s.
Installing#
The library has no runtime dependencies:
pip install seamm_slurm
Basic usage#
from seamm_slurm import LocalSlurm, SshSlurm
from seamm_slurm.script import build_script
backend = LocalSlurm()
# or, from a host that is not itself a SLURM submit host:
# backend = SshSlurm("molssi10")
script = build_script(
{
"job_name": "my-flowchart",
"partition": "batch",
"nodes": 1,
"ntasks": 1,
"time": "01:00:00",
"chdir": "/home/psaxe/SEAMM/Jobs/projects/demo/Job_00123",
},
payload=(
"source /home/psaxe/miniconda3/etc/profile.d/conda.sh\n"
"conda activate seamm\n"
"run_from_jobserver 123 "
"/home/psaxe/SEAMM/Jobs/projects/demo/Job_00123 "
"/home/psaxe/SEAMM/Jobs/seamm.db\n"
),
)
job_id = backend.submit(script)
statuses = backend.poll_many([job_id])
print(statuses[job_id].category) # "pending" | "running" | "completed" | ...
Multiple queues per config file#
A <root>/<jobserver-name>.ini file can describe more than one
cluster/queue target, one section each. load_slurm_config(root,
jobserver_name) resolves a single section (via that file’s
[DEFAULT] default = key, or the sole section if there is only one);
list_sections(root, jobserver_name) instead returns every section as a
{name: SlurmSection} dict, for a caller that routes jobs across more
than one queue or wants to advertise “what queues exist” (e.g. to a
submission UI):
from seamm_slurm.config import list_sections
sections = list_sections(root, "molssi10")
for name, section in sections.items():
print(name, section.type, section.transport)
A section’s type (default "slurm") can also be "local" – no
scheduler at all, for a queue that just means “run this as a plain local
subprocess” rather than a submission target of its own.
build_backend()/build_stager() raise clearly if called on a
type = local section, since it has neither; a caller routes those jobs
through its own local-subprocess path instead. See seamm_jobserver’s
design doc under docs/developer_guide/campaigns/2026-08-10/ (multi-queue
routing) for how this is used to let one JobServer instance route jobs to
several queues – some local, some real SLURM clusters – at once.