[slurm-users] Help with developing a lua job submit script

Roche Ewan ewan.roche at epfl.ch
Wed Oct 10 01:07:34 MDT 2018

Hello David,
for this use case we have two partitions - serial and parallel (the default). Our lua looks like:

function slurm_job_submit(job_desc, part_list, submit_uid)
-- As the default partition is set later by SLURM we need to set it here using the same logic 
        if job_desc.partition == nil then
		local default_partition = "parallel"
                job_desc.partition = default_partition

	if job_desc.partition == "parallel" and job_desc.min_nodes == 1 then
		if job_desc.min_cpus <= 12 and job_desc.shared ~= 0 then
			local serial_partition = "serial" 
			job_desc.partition = serial_partition
			slurm.log_info("slurm_job_modify: for user %u , setting partition: %s", submit_uid, serial_partition)

	return slurm.SUCCESS

The initial partition logic is to avoid jobs that were submitted to specific partitions such as debug being re-routed by the plugin. Our cutoff is 12 cores (half a node) and we respect the “exclusive" option by looking at the value of job_desc.shared.

Good luck!

Ewan Roche

> On 9 Oct 2018, at 17:54, Baker D.J. <D.J.Baker at soton.ac.uk> wrote:
> Hello,
> We are starting to think about developing a lua job submission script. For example, we are keen to route jobs requiring no more than 1 compute node (single core jobs and small parallel jobs) to a slurm shared partition. The idea being that "small" jobs can share a small set of compute nodes to try to prevent resource fragmentation in the cluster. Other "larger" jobs are routed to the default partition.
> As a start I have dug out the example lua script provided by slurm, however I wondered if there was any experience in doing this sort of routing using a lua script. We would appreciate any advice from the slurm community, please.
> Best regards,
> David

More information about the slurm-users mailing list