Hello,

I'm writing my own "job_submit.lua" for controlling in what partition a user can run a "srun" and how many CPUs and nodes are allowed. I want to allow only "srun" in partition "interactive" with only one core and one node. I have wrote this script but I'm getting errors:
function slurm_job_submit(job_desc, part_list, submit_uid)
        local partition = "interactive"
        if ((job_desc.script == nil or job_desc.script == '') and job_desc.partition ~= partition) then
                slurm.log_info("slurm_job_submit: interactive job submitted by user_id:%d to partition:%s rejected", job_desc.user_id, job_desc.partition)
                return slurm.FAILURE
        end
       
        local max = 1


        if (job_desc.cpus_per_task > max or job_desc.max_cpus > max or job_desc.max_nodes > max) then
                slurm.log_user("slurm_job_submit: parameter error %s %s %u", job_desc.cpus_per_task, job_desc.max_cpus, job_desc.max_nodes)
                return slurm.FAILURE
        end

        return slurm.SUCCESS
end

It seems fields "cpus_per_task" and "max_cpus" are not being printed correctly ("max_nodes" is allright), because after running "srun" with this:
    srun -p interactive.q -N 1 -n 1 -w aolin15 --pty bash

...I get this error:
    srun: error: slurm_job_submit: parameter error 65534 4294967294 1

Fields "cpus_per_task" is uint16_t, while "max_cpus" and "max_nodes" are uint32_t... but I have tried with "%u" and it didn't work...


Could anybody help me?

Thanks.


Reply via email to