[slurm-users] Filter slurm e-mail notification

Aaron Jackson aaron at aaronsplace.co.uk
Wed Nov 27 21:20:25 UTC 2019

>> Hi,
>> I guess you could use a lua script to filter out flags you don't
>> want. I haven't tried it with mail flags, but I'm using a script like
>> the one referenced to enforce accounts/time limits, etc.
>> https://funinit.wordpress.com/2018/06/07/how-to-use-job_submit_lua-with-slurm/
>> Cheers,
>> Florian
> I decided to have a play with this, out of curiosity.
> The mail types are defined in slurm.h. The ninth bit is set to send mail
> for array tasks. Lua (before 5.3) has nasty support for bitwise
> operations. Since there are no mail types defined higher than this (at
> this time) it should be possible just to check if it mail_type is
> greater than 255, and if so, subtract 256.
> However, the Lua Slurm API mail_type property seems to be
> immutable. Adding support should be relatively simple, unless I'm
> missing something. May just be simpler to write a plugin in C.
> Aaron

It was very simple to add support to the Lua job_submit plugin. I have
added a patch on the bug tracker. I probably did something wrong but we
will see. Very small patch below if anyone is interested.


diff --git a/src/plugins/job_submit/lua/job_submit_lua.c b/src/plugins/job_submit/lua/job_submit_lua.c
index e4f363674c..6405230281 100644
--- a/src/plugins/job_submit/lua/job_submit_lua.c
+++ b/src/plugins/job_submit/lua/job_submit_lua.c
@@ -1085,6 +1085,8 @@ static int _set_job_req_field(lua_State *L)
                        job_desc->tres_per_node = xstrdup(value_str);
        } else if (!xstrcmp(name, "immediate")) {
                job_desc->immediate = luaL_checknumber(L, 3);
+       } else if (!xstrcmp(name, "mail_type")) {
+               job_desc->mail_type = luaL_checknumber(L, 3);
        } else if (!xstrcmp(name, "licenses")) {
                value_str = luaL_checkstring(L, 3);

More information about the slurm-users mailing list