<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hello everyone,<br>
<br>
thanks for all the answers.<br>
<br>
To elaborate further: I'm developing in C, but that's not a
problem since I can find an equivalent to LUA as Jeffrey T Frey
said.<br>
One more thing I'd like to point out, is that I need to monitor
jobs going from pending to running state (after waiting in the
jobs queue). I currently have a separate pthread to achieve this,
but I think at this point the job_submit()/job_modify() function
has already exited.<br>
I do get the output of the slurm_kill_job() function when called,
but that's not useful for the user and I couldn't find a way to
append custom messages.<br>
<br>
Again, thanks everyone who helped.<br>
Regards,<br>
Lorenzo<br>
</p>
<div class="moz-cite-prefix">On 19/07/23 16:00, Jeffrey T Frey
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:0B12F7EC-B36D-462D-85FB-F19AFB083375@udel.edu">
<pre class="moz-quote-pre" wrap="">In case you're developing the plugin in C and not LUA, behind the scenes the LUA mechanism is concatenating all log_user() strings into a single variable (user_msg). When the LUA code completes, the C code sets the *err_msg argument to the job_submit()/job_modify() function to that string, then NULLs-out user-msg. (There's a mutex around all of that code so slurmctld never executes LUA job submit/modify scripts concurrently.) The slurmctld then communicates that returned string back to sbatch/salloc/srun for display to the user.
Your C plugin would do likewise — set *err_msg before returning from job_submit()/job_modify() — and needn't be mutex'ed if the code is reentrant.
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">On Jul 19, 2023, at 08:37, Angel de Vicente <a class="moz-txt-link-rfc2396E" href="mailto:angel.de.vicente@iac.es"><angel.de.vicente@iac.es></a> wrote:
Hello Lorenzo,
Lorenzo Bosio <a class="moz-txt-link-rfc2396E" href="mailto:lorenzo.bosio@unito.it"><lorenzo.bosio@unito.it></a> writes:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">I'm developing a job submit plugin to check if some conditions are met before a job runs.
I'd need a way to notify the user about the plugin actions (i.e. why its jobs was killed and what to do), but after a lot of research I could only write to logs and not the user shell.
The user gets the output of slurm_kill_job but I can't find a way to add a custom note.
Can anyone point me to the right api/function in the code?
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
In our "job_submit.lua" script we have the following for that purpose:
,----
| slurm.log_user("%s: WARNING: [...]", log_prefix)
`----
--
Ángel de Vicente
Research Software Engineer (Supercomputing and BigData)
Tel.: +34 922-605-747
Web.: <a class="moz-txt-link-freetext" href="http://research.iac.es/proyecto/polmag/">http://research.iac.es/proyecto/polmag/</a>
GPG: 0x8BDC390B69033F52
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
</pre>
</blockquote>
<div class="moz-signature">-- <br>
<font size="2"><b><i>Dott. Mag. Lorenzo Bosio</i></b><br>
</font>
<div> <font size="2">Tecnico di Ricerca<br>
</font> </div>
<font size="2"> Dipartimento di Informatica<br>
</font>
<div><font size="2"><br>
</font> <font size="2"><img
data-aii="CiExaXU1RzNKc01RSzAyLS1sUDRNamd5OTFqSDRZU2xNOFA"
src="https://ci3.googleusercontent.com/mail-sig/AIorK4xAm25VP8DgvHTmt9lWbEyODf4Xy_OgLHzTF7ofW7ea_K2ZOgUXrrhbqjUvihlNdKWvctWair8"
data-os="https://lh3.googleusercontent.com/d/1iu5G3JsMQK02--lP4Mjgy91jH4YSlM8P"
width="420" height="119"><br>
</font> </div>
<font size="2">
</font>
<div><font size="2">Università degli Studi di Torino<br>
</font> </div>
<font size="2">
</font>
<div><font size="2">Corso Svizzera, 185 - 10149 Torino<br>
</font> </div>
<font size="2">
</font>
<div><font size="2">tel. +39 011 670 6836</font></div>
</div>
</body>
</html>