[slurm-users] memory in job_submit.lua

Bjørn-Helge Mevik b.h.mevik at usit.uio.no
Thu Feb 27 11:26:09 UTC 2020


Marcus Wagner <wagner at itc.rwth-aachen.de> writes:

> does anyone know how to detect in the lua submission script, if the
> user used --mem or --mem-per-cpu?
>
> And also, if it is possible to "unset" this setting?

Something like this should work:

if job_desc.pn_min_memory ~= slurm.NO_VAL64 then
   -- --mem or --mem-per-cpu was used; unset it
   job_desc.pn_min_memory = slurm.NO_VAL64
end

> The reason is, we want to remove all memory thingies set by the user
> for exclusive jobs.

We just reject jobs if they use a setting we don't allow -- that avoids
jobs running differently than what the user believed.  For instance:

   -- Bigmem jobs should specify memory, no other job should
   if job_desc.pn_min_memory == slurm.NO_VAL64 then
      -- If bigmem: fail
      if job_desc.partition == "bigmem" then
         slurm.log_info(
            "bigmem job from uid %d without memory specification: Denying.",
            job_desc.user_id)
         slurm.user_msg("--mem or --mem-per-cpu required for bigmem jobs")
         return 2044 -- Signal ESLURM_INVALID_TASK_MEMORY
      end
   else
      -- If not bigmem: fail
      if job_desc.partition ~= "bigmem" then
         slurm.log_info(
            "non-bigmem job from uid %d with memory specification: Denying.",
            job_desc.user_id)
         slurm.user_msg("Memory specification only allowed for bigmem jobs")
         return 2044 -- Signal ESLURM_INVALID_TASK_MEMORY
      end
   end

-- 
Regards,
Bjørn-Helge Mevik, dr. scient,
Department for Research Computing, University of Oslo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.schedmd.com/pipermail/slurm-users/attachments/20200227/d4f1369f/attachment-0001.sig>


More information about the slurm-users mailing list