<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>With regards to the lua scripting, yes, you can modify a job and
set the time limit to something if it is not appropriate.<br>
Treydock has one that does exactly that (among other things) at
<a class="moz-txt-link-freetext" href="https://gist.github.com/treydock/b964c5599fd057b0aa6a#file-job_submit-lua">https://gist.github.com/treydock/b964c5599fd057b0aa6a#file-job_submit-lua</a></p>
<p>You will have to distill the parts you need out of it.</p>
<p>Brian Andrus<br>
</p>
<div class="moz-cite-prefix">On 12/3/2021 2:11 AM, Gestió Servidors
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:PR3PR07MB8068681ED14230C3A2B8B547F26A9@PR3PR07MB8068.eurprd07.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style>@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"Texto sin formato Car";
margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}span.TextosinformatoCar
{mso-style-name:"Texto sin formato Car";
mso-style-priority:99;
mso-style-link:"Texto sin formato";
font-family:"Calibri",sans-serif;}.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}div.WordSection1
{page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoPlainText">Hi,<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Answering between lines...<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText" style="margin-left:35.4pt">> Hi;</p>
<p class="MsoPlainText" style="margin-left:35.4pt">> </p>
<p class="MsoPlainText" style="margin-left:35.4pt">> The
EnforcePartLimits parameter in slurm.conf, should be set to
ALL or ANY</p>
<p class="MsoPlainText" style="margin-left:35.4pt">> to
enforce time limit for partition.</p>
<p class="MsoPlainText" style="margin-left:35.4pt">> </p>
<p class="MsoPlainText" style="margin-left:35.4pt">> Regards.</p>
<p class="MsoPlainText" style="margin-left:35.4pt">> </p>
<p class="MsoPlainText" style="margin-left:35.4pt">> Ahmet M.</p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">I have not configured
"EnforcePartLimits" in my slurm.conf file, so I suppose that
my SLURM is running with "default" value "NO", so my job will
be accept and remain queued until the partition limits are
altered (as SLURM documentation says and me too ;) )<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText" style="margin-left:35.4pt">>I look at
it this way (so it makes sense):<o:p></o:p></p>
<p class="MsoPlainText" style="margin-left:35.4pt">><o:p> </o:p></p>
<p class="MsoPlainText" style="margin-left:35.4pt">>It goes
into a pending state because it is possible for the time to
become available (you could just run a command that increases
the<o:p></o:p></p>
<p class="MsoPlainText" style="margin-left:35.4pt">>timelimit)
so it is waiting for that to happen. This is useful because
you may have some users have a job that does indeed need to go
that long, but they have to let you know to allow it to
happen.<o:p></o:p></p>
<p class="MsoPlainText" style="margin-left:35.4pt">><o:p> </o:p></p>
<p class="MsoPlainText" style="margin-left:35.4pt">>If you do
not want ANY jobs to queue up if they are asking for more time
than is available, you can add some code to the job_submit.lua<o:p></o:p></p>
<p class="MsoPlainText" style="margin-left:35.4pt">><o:p> </o:p></p>
<p class="MsoPlainText" style="margin-left:35.4pt">>Here is a
snippet from mine:<o:p></o:p></p>
<p class="MsoPlainText" style="margin-left:35.4pt">><o:p> </o:p></p>
<p class="MsoPlainText" style="margin-left:35.4pt">>?? if
time_limit > part_max_time then<o:p></o:p></p>
<p class="MsoPlainText" style="margin-left:35.4pt">> ??????
slurm.log_info("job from uid %d with request for more than<o:p></o:p></p>
<p class="MsoPlainText" style="margin-left:35.4pt">>max_time:
Denying.",job_desc.user_id)<o:p></o:p></p>
<p class="MsoPlainText" style="margin-left:35.4pt">> ??????
slurm.log_user("You cannot request more than %s minutes in
partition %s!!", part_max_time, partition) ?????? return
slurm.ESLURM_INVALID_TIME_LIMIT ?? end><o:p></o:p></p>
<p class="MsoPlainText" style="margin-left:35.4pt">><o:p> </o:p></p>
<p class="MsoPlainText" style="margin-left:35.4pt">>The
time_limit, part_max_time and partition variables are mapped
from job_desc and part_list<o:p></o:p></p>
<p class="MsoPlainText" style="margin-left:35.4pt">><o:p> </o:p></p>
<p class="MsoPlainText" style="margin-left:35.4pt">>Brian
Andrus<o:p></o:p></p>
<p class="MsoPlainText" style="margin-left:35.4pt"><o:p> </o:p></p>
<p class="MsoPlainText">I think solution modifying “lua” script
is a good solution. Could I do something like this?<o:p></o:p></p>
<p class="MsoPlainText" style="margin-left:35.4pt">if time_limit
> part_max_time then<o:p></o:p></p>
<p class="MsoPlainText"
style="margin-left:35.4pt;text-indent:35.4pt">slurm.log_info("job
from uid %d with request for more than max_time: Reconfiguring
your job.",job_desc.user_id)<o:p></o:p></p>
<p class="MsoPlainText"
style="margin-left:35.4pt;text-indent:35.4pt">slurm.log_user("You
cannot request more than %s minutes in partition %s!!",
part_max_time, partition)<o:p></o:p></p>
<p class="MsoPlainText"
style="margin-left:35.4pt;text-indent:35.4pt">time_limit=part_max_time<o:p></o:p></p>
<p class="MsoPlainText" style="text-indent:35.4pt">end<o:p></o:p></p>
<p class="MsoPlainText" style="text-indent:35.4pt">return
slurm.ESLURM_INVALID_TIME_LIMIT<o:p></o:p></p>
<p class="MsoPlainText" style="text-indent:35.4pt"><o:p> </o:p></p>
<p class="MsoPlainText" style="text-indent:35.4pt"><o:p> </o:p></p>
<p class="MsoPlainText">In other words: if a user submits a jobs
with TimeLimit bigger than partition TimeLimit, assign
partition TimeLimit to his/her job.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Thanks.<o:p></o:p></p>
</div>
</blockquote>
</body>
</html>