<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body>
<div class="moz-cite-prefix">Hi Florian, and first of all , thanks
for this single line command which is already quite a lot; To give
it a bit more sense, I will compute the remaining time until the
reservation ends, so just changing $2 in $3 in your command<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<blockquote>
<div class="moz-cite-prefix"># WEEKRESEND=$(scontrol show res |
head -n1 | awk '{print $3}' | cut -f2 -d= | xargs -I {} date +%s
--date "{}" )
<div># NOW=$(date +%s)</div>
<div># echo "$(((WEEKRESEND - NOW) / 3600)) hours left until
reservation ends"</div>
<div>178 hours left until reservation ends</div>
</div>
</blockquote>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Trying to give some sense, here is the
use case. We use slurm for allocating resources for teaching
purposes. We want to allow the students to allocate as they wish
during the week ends, starting friday evening up to monday early
morning. For that we think about creating a reservation that is
regularly scheduled every week and assigned to a partition with
part of the nodes we want the students to be able to work with.
Then comes the reason why we need to set the timelimit. The
partition have their timelimit and we set it to, say, 2 days and a
half for a job submitted on friday evening to be allowed to run
until monday morning. Now, suppose a user starts a job on sunday
evening without specifying the timelimit of its jobs, the default
will be the partition's one (2 days and a half) and if there is a
reservation scheduled on monday morning, for a practical say, if
I'm not wrong, slurm will not allow the allocation because it will
consider that sunday evening + the default partition timelimit
will overlap with a planned reservation, which makes sense. The
first answer could be to ask the user to specify the timelimit on
its job so that it's allocation does not overlap with the next
reservation but we thought about automatically setting that, hence
my question. <br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">So, in our use case, it's not a problem
to kill a job by the end of the reservation even if the job is not
completed because we may need the resources for a practical on
monday morning. <br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Now, back to your proposal; I was
thinking about putting that line in a job prolog but .... maybe
that's was you meant by "putting the cart before the horse", I may
run into troubles : for the prolog to be executed, the job has
to the allocated but It will not with the default timelimit of the
partition because slurm may not allow it (given a practical may be
reserved on monday morning) . Do you think there is any other way
than asking the user to set the timelimit himself in its
srun/sbatch command ?<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Best;</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Jeremy.<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">On 29/03/2021 22:09, Florian Zillner
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:TY2PR03MB4493B492E9283CBD503A3E27A87E9@TY2PR03MB4493.apcprd03.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0); background-color: rgb(255,
255, 255);">
Hi,</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0); background-color: rgb(255,
255, 255);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0); background-color: rgb(255,
255, 255);">
well, I think you're putting the cart before the horse, but
anyway, you could write a script that extracts the next
reservation and does some simple math to display the time in
hours or else to the user. It's the users job to set the time
their job needs to finish. Auto-squeezing a job that takes 2
days to complete into a remaining 2 hour window until the
reservation starts doesn't make any sense to me.</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0); background-color: rgb(255,
255, 255);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0); background-color: rgb(255,
255, 255);">
# NEXTRES=$(scontrol show res | head -n1 | awk '{print $2}' |
cut -f2 -d= | xargs -I {} date +%s --date "{}" )
<div># NOW=$(date +%s)</div>
<div># echo "$(((NEXTRES - NOW) / 3600)) hours left until
reservation begins"</div>
<div>178 hours left until reservation begins</div>
</div>
<div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0);">
Cheers,</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0);">
Florian</div>
<div id="Signature">
<div style="">
<div style=""><br>
</div>
</div>
</div>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif;
font-size: 11pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size: 11pt;"
face="Calibri, sans-serif" color="#000000"><b>From:</b>
slurm-users <a class="moz-txt-link-rfc2396E" href="mailto:slurm-users-bounces@lists.schedmd.com"><slurm-users-bounces@lists.schedmd.com></a> on
behalf of Jeremy Fix <a class="moz-txt-link-rfc2396E" href="mailto:Jeremy.Fix@centralesupelec.fr"><Jeremy.Fix@centralesupelec.fr></a><br>
<b>Sent:</b> Monday, 29 March 2021 10:48<br>
<b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:slurm-users@lists.schedmd.com">slurm-users@lists.schedmd.com</a>
<a class="moz-txt-link-rfc2396E" href="mailto:slurm-users@lists.schedmd.com"><slurm-users@lists.schedmd.com></a><br>
<b>Subject:</b> [External] [slurm-users] Autoset job TimeLimit
to fit in a reservation</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span
style="font-size:11pt">
<div class="PlainText">Hi,<br>
<br>
I'm wondering if there is any built-in option to autoset a
job TimeLimit<br>
to fit within a defined reservation.<br>
<br>
For now, it seems to me that the timelimit must be
explicitely provided,<br>
in a agreement with the deadline of the reservation, by a
user when<br>
invoking the srun or sbatch command while I would find it
comfortable to<br>
let slurm calculate the remaining time of the reservation
on which<br>
srun/sbatch is executed and fill in the TimeLimit
accordingly;<br>
<br>
Best;<br>
<br>
Jeremy.<br>
<br>
<br>
</div>
</span></font></div>
</blockquote>
<br>
</body>
</html>