<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<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></div>
<div></div>
<div></div>
<div></div>
<div style="">
<div style=""><br>
</div>
<div style=""></div>
</div>
</div>
</div>
<div id="appendonsend"></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 face="Calibri, sans-serif" color="#000000" style="font-size: 11pt;"><b>From:</b> slurm-users <slurm-users-bounces@lists.schedmd.com> on behalf of Jeremy Fix <Jeremy.Fix@centralesupelec.fr><br>
<b>Sent:</b> Monday, 29 March 2021 10:48<br>
<b>To:</b> slurm-users@lists.schedmd.com <slurm-users@lists.schedmd.com><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>
</body>
</html>