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. > On Jul 19, 2023, at 08:37, Angel de Vicente <angel.de.vice...@iac.es> wrote: > > Hello Lorenzo, > > Lorenzo Bosio <lorenzo.bo...@unito.it> writes: > >> 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? > > 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.: http://research.iac.es/proyecto/polmag/ > > GPG: 0x8BDC390B69033F52