<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hello,</p>
<p><br>
</p>
<p>the easiest way to identify interactive jobs is probably via
job_submit.lua - if a submitted job does not have an associated
job script, it's most likely interactive.</p>
<p><br>
</p>
<p>As an example snippet, at our cluster we force interactive jobs
into their own partition (has the advantage that you can attach an
"interactive" QOS to that partition to enforce specific limits
like e.g. only allowing one interactive job per user):</p>
<p><br>
</p>
<p>--- /etc/slurm/job_submit.lua ---</p>
<p><br>
</p>
<p>function slurm_job_submit(job_desc, part_list, submit_uid)</p>
<p> local log_prefix = "slurm_job_submit"<br>
</p>
<p> local interactive_partition = "interactive"</p>
<p> -- ... more local variable definitions and setup ... <br>
</p>
<p> <br>
</p>
<p> -- check for interactive</p>
<p> if (job_desc.script == nil or job_desc.script == '') then<br>
job_desc.partition = interactive_partition<br>
slurm.log_info("%s: normal job seems to be interactive,
moved to %s partition.", log_prefix, job_desc.partition)<br>
end</p>
<p> <br>
</p>
<p> -- ...some more job filtering ...</p>
<p><br>
</p>
<p> slurm.log_info("%s: for user %u, setting partition(s): %s.",
log_prefix, submit_uid, job_desc.partition)<br>
slurm.log_user("Job \"%s\" queued to partition(s): %s.",
job_desc.name, job_desc.partition)<br>
</p>
<p> return slurm.SUCCESS</p>
<p>end<br>
</p>
<p><br>
</p>
<p>function slurm_job_modify(job_desc, job_rec, part_list,
modify_uid)<br>
return slurm.SUCCESS<br>
end<br>
<br>
slurm.log_info("initialized")<br>
return slurm.SUCCESS<br>
</p>
<p><br>
</p>
<p>--- /etc/slurm/job_submit.lua ---</p>
<p><br>
</p>
<p>Of course, if you only want to keep interactive jobs out of a
specific partition, you could additionally check
job_desc.partition for that partition's name in the above if-block
and then decide what to do with it (change job partition to an
allowed one, reject the job completely by returning slurm.ERROR,
...) <br>
</p>
<p><br>
</p>
<p>Best regards,<br>
René Sitt<br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">Am 09.05.22 um 14:17 schrieb Moshe
Mergy:<br>
</div>
<blockquote type="cite"
cite="mid:7e039bd703a94714930a71879dfd1e28@weizmann.ac.il">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<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">
<div>Hi all,</div>
<div><br>
</div>
<div>How could I define a partition dedicated to batch jobs
only, i.e. to use with sbatch only, </div>
<div>not permitting to run srun/interactive jobs on it?</div>
<div>Using Slurm options ? </div>
<div>Using a Lua script blocking srun ? (though I don't
understand much in Lua scripts)</div>
<div><br>
</div>
<div>I currently use Slurm 20.02</div>
<div>Thanks a lot for your help!</div>
<div><br>
</div>
<div>Moshe</div>
<br>
</div>
</blockquote>
<pre class="moz-signature" cols="72">--
Dipl.-Chem. René Sitt
Hessisches Kompetenzzentrum für Hochleistungsrechnen
Philipps-Universität Marburg
Hans-Meerwein-Straße
35032 Marburg
Tel. +49 6421 28 23523
<a class="moz-txt-link-abbreviated" href="mailto:sittr@hrz.uni-marburg.de">sittr@hrz.uni-marburg.de</a>
<a class="moz-txt-link-abbreviated" href="http://www.hkhlr.de">www.hkhlr.de</a></pre>
</body>
</html>