Job Submission Lua Plugin
Overview
Slurm's job-plugin interface provides a facility for cluster admins to intercept, modify, and/or deny users' resource requests. This feature enables functionality like ensuring jobs have comments for resource tracking, or setting a default 'timelimit' for interactive jobs. The plugin behaviour is specified in a Lua file (/mnt/customer/job_submit.lua) which provides a flexible and powerful interface enabling broad functionality.
For more background on Slurm's job plugin, see Slurm's job submit plugin docs or the job_submit_lua.so source code for details on the Lua integration.
Script Requirements
The script must be placed in /mnt/customer/job_submit.lua, and return a module with functions for slurm_job_submit and slurm_job_modify. See the 'API' section for function specifications.
After modifying the job_submit.lua, run scontrol reconfigure to apply the changes. slurmctld internally caches the most recent working version of the job_submit.lua. If a custom job_submit.lua script fails to load, this may result in either a no-op at job submission time, or the behaviour of the last successful job_submit.lua. Further, if the update job_submit.lua fails to load, errors may be logged at /mnt/customer/job_submit_lua.log.
If the job_submit.lua file is not found, or if the job_submit.lua file is missing functions, errors are reported in /mnt/customer/job_submit_lua.log.
The Lua script is run by the slurmctld on the controller pod. The shared-/home directory is not accessible from the slurm-controller. To generate persistent logs, write to /mnt/customer, see the log() function in the Example section below.
API
function slurm_job_submit(job_desc, part_list, submit_uid)
This function is called when a job is submitted. It can be triggered by salloc, sbatch, or srun.
Arguments:
job_desc: Requested job allocationpart_list: List of partitions the user is authorized to usesubmit_uid: User ID of requesting user
return values
slurm.SUCCESSon successslurm.ERRORfor generic errorsslurm.ESLURM_*for specific errors (see slurm/slurm_errno.h)
function slurm_job_modify(job_desc, job_rec, part_list, uid)
This function is called when a job-modification request is made.
Arguments:
job_desc: Specification of requested modificationsjob_ptr: Pointer to the job to be modifiedpart_list: List of partitions the user is authorized to usemodify_uid: User ID of requesting user
return values
slurm.SUCCESSon successslurm.ERRORfor generic errorsslurm.ESLURM_*for specific errors (see slurm/slurm_errno.h)
Example Plugin
Here's a sample plugin to get up and running quickly. It enforces that all allocation requests have eight GPUs per node (i.e. --gpus-per-node=8).
We also provide a simple test-harness which is useful for development/debugging.
Last updated

