<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>OK, to answer my own question.</p>
<p><br>
</p>
<p>First of all, inspect.lua from here is helpful:</p>
<p><br>
</p>
<p><a href="https://raw.githubusercontent.com/kikito/inspect.lua/master/inspect.lua" class="OWAAutoLink" id="LPlnk405418" previewremoved="true">https://raw.githubusercontent.com/kikito/inspect.lua/master/inspect.lua</a><br>
</p>
<p><br>
</p>
<p>You can then do the following in your job_submit.lua</p>
<p><br>
</p>
<p></p>
<div>package.path = package.path .. ';/etc/slurm/?.lua'</div>
<div><span style="font-size: 12pt;">local inspect = require("inspect")</span><br>
</div>
<br>
<p></p>
<p></p>
<div>function slurm_job_submit(job_desc, part_list, submit_uid)</div>
<div><span style="font-size: 12pt;">  slurm.log_user(inspect(slurm))</span><br>
</div>
<div>  return slurm.SUCCESS</div>
<div>end</div>
<div><br>
</div>
<div>which might tell you the following on an srun:</div>
<div><br>
</div>
<div>
<div>srun:   reservations = {</div>
<div>srun:     root_1 = {</div>
<div>srun:       <metatable> = {</div>
<div>srun:         __index = <function 18>,</div>
<div>srun:         _resv_ptr = <userdata 8></div>
<div>srun:       }</div>
<div>srun:     }</div>
<div>srun:   },</div>
<br>
</div>
<div>From there on you can do</div>
<div><br>
</div>
<div>
<div>  for a, b in pairs(slurm.reservations) do</div>
<div>    slurm.log_user("a = %s", inspect(a))</div>
<div>    slurm.log_user("b = %s", inspect(b))</div>
<div>    slurm.log_user("--")</div>
<div>  end</div>
<br>
</div>
<div>and get</div>
<div><br>
</div>
<div>
<div>srun: a = "root_1"</div>
<div>srun: b = {</div>
<div>srun:   <metatable> = {</div>
<div>srun:     __index = <function 1>,</div>
<div>srun:     _resv_ptr = <userdata 1></div>
<div>srun:   }</div>
<div>srun: }</div>
<div>srun: --</div>
<br>
</div>
<div>Aaaand now, you can -- obviously, more or less -- look here for the field names:</div>
<div><br>
</div>
<div><a href="https://github.com/SchedMD/slurm/blob/master/src/plugins/job_submit/lua/job_submit_lua.c#L236" class="OWAAutoLink" id="LPlnk591191" previewremoved="true">https://github.com/SchedMD/slurm/blob/master/src/plugins/job_submit/lua/job_submit_lua.c#L236</a><br>
</div>
<div><br>
</div>
<div>E.g,</div>
<div><br>
</div>
<div>
<div>  for a, b in pairs(slurm.reservations) do</div>
<div>    slurm.log_user("i = %s", inspect(a))</div>
<div>    slurm.log_user(inspect(b.start_time))</div>
<div>    slurm.log_user("--")</div>
<div>  end</div>
<br>
</div>
<div>might print</div>
<div><br>
</div>
<div>
<div>srun: i = "root_1"</div>
<div>srun: 1630598400</div>
<div>srun: --</div>
<br>
</div>
<div>Maybe that's useful for someone.</div>
<div><br>
</div>
<div>Best wishes,</div>
<div>Manuel</div>
<p></p>
<div id="Signature">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px">
<div style="font-family:Tahoma; font-size:13px"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> slurm-users <slurm-users-bounces@lists.schedmd.com> on behalf of Holtgrewe, Manuel <manuel.holtgrewe@bih-charite.de><br>
<b>Sent:</b> Wednesday, September 1, 2021 7:51:39 PM<br>
<b>To:</b> slurm-users@lists.schedmd.com<br>
<b>Subject:</b> [ext] [slurm-users] Access reservation list from job_submit.lua?</font>
<div> </div>
</div>
<div>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<div>Hi,<br>
<br>
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.<br>
<br>
Is it possible to access this information from Lua?<br>
<br>
Best wishes,<br>
Manuel<br>
<br>
</div>
</div>
</div>
</body>
</html>