[slurm-users] [ext] Access reservation list from job_submit.lua?
    Holtgrewe, Manuel 
    manuel.holtgrewe at bih-charite.de
       
    Wed Sep  1 19:56:32 UTC 2021
    
    
  
OK, to answer my own question.
First of all, inspect.lua from here is helpful:
https://raw.githubusercontent.com/kikito/inspect.lua/master/inspect.lua
You can then do the following in your job_submit.lua
package.path = package.path .. ';/etc/slurm/?.lua'
local inspect = require("inspect")
function slurm_job_submit(job_desc, part_list, submit_uid)
  slurm.log_user(inspect(slurm))
  return slurm.SUCCESS
end
which might tell you the following on an srun:
srun:   reservations = {
srun:     root_1 = {
srun:       <metatable> = {
srun:         __index = <function 18>,
srun:         _resv_ptr = <userdata 8>
srun:       }
srun:     }
srun:   },
>From there on you can do
  for a, b in pairs(slurm.reservations) do
    slurm.log_user("a = %s", inspect(a))
    slurm.log_user("b = %s", inspect(b))
    slurm.log_user("--")
  end
and get
srun: a = "root_1"
srun: b = {
srun:   <metatable> = {
srun:     __index = <function 1>,
srun:     _resv_ptr = <userdata 1>
srun:   }
srun: }
srun: --
Aaaand now, you can -- obviously, more or less -- look here for the field names:
https://github.com/SchedMD/slurm/blob/master/src/plugins/job_submit/lua/job_submit_lua.c#L236
E.g,
  for a, b in pairs(slurm.reservations) do
    slurm.log_user("i = %s", inspect(a))
    slurm.log_user(inspect(b.start_time))
    slurm.log_user("--")
  end
might print
srun: i = "root_1"
srun: 1630598400
srun: --
Maybe that's useful for someone.
Best wishes,
Manuel
________________________________
From: slurm-users <slurm-users-bounces at lists.schedmd.com> on behalf of Holtgrewe, Manuel <manuel.holtgrewe at bih-charite.de>
Sent: Wednesday, September 1, 2021 7:51:39 PM
To: slurm-users at lists.schedmd.com
Subject: [ext] [slurm-users] Access reservation list from job_submit.lua?
Hi,
I have trouble finding examples for job_submit.lua code that uses the global Slurm reservations. I want to adjust the maximal running time of jobs with respect to the closest reservation flagged as "maintenance". However, I cannot find any job_submit.lua coda that accesses the Slurm reservations code.
Is it possible to access this information from Lua?
Best wishes,
Manuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schedmd.com/pipermail/slurm-users/attachments/20210901/45474b0c/attachment.htm>
    
    
More information about the slurm-users
mailing list