Using sjp in job submit.lua - KasperSkytte/slurmjobpacker GitHub Wiki
Requires JobSubmitPlugins=lua in slurm.conf.
local ok, sjp = pcall(dofile, "/opt/slurmjobpacker/lua/sjp.lua")
if not ok then
slurm.log_error("job_submit: cannot load sjp.lua: %s", tostring(sjp))
sjp = nil
end
function slurm_job_submit(job_desc, part_list, submit_uid)
-- your own rules first
if sjp and sjp.place(job_desc, submit_uid) then
return slurm.SUCCESS
end
-- not placed: your fallback, e.g. by memory per CPU
local cpus = job_desc.min_cpus or 1
local per_cpu = job_desc.min_mem_per_cpu or (job_desc.min_mem_per_node or 0) / cpus
job_desc.partition = per_cpu >= 6000 and "fat1,fat2" or "slim1,slim2"
return slurm.SUCCESS
endsjp.place() never rejects a job. It returns true, or false and a reason, leaving the
job to your rules (only its AdminComment says why: sjp:skipped=<reason>, if empty):
| reason | |
|---|---|
"no room" |
no node that could hold the job has room now |
"no table" |
sjpd not running, or disable file present |
"stale" |
sjpd data too old |
"not batch" |
salloc/srun
|
"gpu" |
GPUs requested |
"reservation" |
in a reservation |
"constraint" |
--constraint: the user asks for particular hardware |
"no usable node in --nodelist" |
the --nodelist nodes are down or not in sjp's partitions |
"no partition holds those nodes" |
no partition holds every --nodelist node |
"multi-node" |
-N 2 or more |
"no memory" |
--mem=0 |
"error" |
see the slurmctld log |
local placed, why = sjp.place(job_desc, submit_uid)When placed: sets partition, req_nodes (pins) and admin_comment (if empty). A job's
own partition is replaced. Its --nodelist and --exclude are kept and sjp chooses among
those nodes, or with [policy] user_nodes = "ignore" they are dropped.
| default | ||
|---|---|---|
sjp.config.verbose |
false |
detailed log line per job |
sjp.config.table_path |
/run/sjp/policy.lua |
if [general] state_dir moved |
sjp.config.disable_path |
/etc/sjp/disable |
if [general] disable_file moved |
lua/job_submit.lua:
salloc/srun to interactive, GPU jobs to GPU_PARTITION, the rest to sjp, with an
optional SLIM/FAT/FAT_ABOVE fallback. The Ansible role can install it
(sjp_job_submit_install: true).
After upgrading sjp: scontrol reconfigure (Slurm doesn't reload dofiled files).