News & Info
Discussion forums have been enabled for this project, feel free to share your thoughts and ideas there.
v2.7.1
- In v2.7.0 dumping of configuration at goslmailer/gobler startup was removed.
- Now it can be selectively enabled with
debugconfig: true
parameter in config filev2.7.0
v2.5.0
New: In addition to json, now supports TOML configuration files (.toml file suffix)
BREAKING CHANGE:
qosmap
changed its format from map[int]string to map[string]int. Adopt the goslmailer config file accordingly."qosmap": { # map of your sites configured QoSes, with their timelimits (seconds), used for hint generation - "3600": "RAPID", - "28800": "SHORT", - "172800": "MEDIUM", - "1209600": "LONG" "qosmap": { # map of your sites configured QoSes, with their timelimits (seconds), used for hint generation + "RAPID": 3600, + "SHORT": 28800, + "MEDIUM": 172800, + "LONG": 1209600 }
Goslmailer (GoSlurmMailer) is a drop-in replacement MailProg for slurm.
With goslmailer configured as as the slurm mailer,
MailProg = /usr/bin/goslmailer
it provides users with the ability to specify a comma-separated list of receivers [connector:]target
in the sbatch --mail-user
switch to select where the messages will be sent out (similar to URI scheme).
e.g.
sbatch --mail-type=ALL --mail-user="mailto:useremailA,msteams:usernameB,telegram:NNNNNNN,usernameC"
To support future additional receiver schemes, a connector package has to be developed and its configuration block present in configuration file.
--mail-user=discord:<channelId>
--mail-user=matrix:<roomId>
--mail-user=telegram:<chatId>
--mail-user=mailto:<email-addr>
--mail-user=msteams:<userId>
--mail-user=slack:<userId>
OR --mail-user=slack:<channelId>
mattermost
:channelIdSee each connector details below...
Unpack, follow instructions
git clone https://github.com/CLIP-HPC/goslmailer.git
make test
make build
make install
Prerequisites:
ssh-keygen -t rsa
)ssh $USER@localhost
must work without passwordKnown caveats:
redhat-lsb-core
set enable-bracketed-paste off
present in ~/.inputrc
export TERM=dumb
in ~/.bashrc
:)run_goslmailer: validation *exec.RunRequest failed: target was empty at exec.run at workflow.run
run_loop_over_tests_casestest_00: run_goslmailer: validation *exec.RunRequest failed: target was empty at exec.run at workflow.run
try:
mkdir $HOME/.secret
ssh-keygen -b 1024 -t rsa -f id_rsa -P "" -f $HOME/.secret/id_rsa
touch ~/.ssh/authorized_keys
cat $HOME/.secret/id_rsa.pub >> ~/.ssh/authorized_keys
# downloads endly binary and runs endly tests
make
/etc/slurm/goslmailer.conf
(default path)
GOSLMAILER_CONF=/path/to/gosl.conf
in environmentMailProg
to the binaryIn high-throughput clusters or in situations where job/message spikes are common, it might not be advisable to try to send all of the incoming messages as they arrive. For these environments goslmailer can be configured to spool messages from certain connectors on disk, to be later processed by the gobler service.
gobler is a daemon program that can be configured to monitor specific spool directories for messages, process them and send out using the same connectors as goslmailer.
On startup, gobler reads its config file and spins-up a connector monitor
for each configured spool directory.
connector monitor
in turn spins up 3 goroutines: monitor
, picker
and numSenders
x sender
.
monitor :
monitorT
seconds (or milliseconds) scans the spoolDir
for new messages and sends them to the pickerpicker :
maxMsgPU
pickerT
seconds (or milliseconds) picks the next message to be delivered and sends it to the sender (ordering by time of arrival)sender :
numSenders
goroutines are waiting for messages from the picker and try to deliver them. In case of failure, messages are returned to the picker for a later retryconnector | spooling/throttling capable (gobler) |
---|---|
mattermost | yes |
discord | yes |
matrix | no |
telegram | yes |
msteams | yes |
mailto | no |
slack | yes |
Specifies which receiver scheme is the default one, in case when user didn't specify --mail-user
and slurm sent a bare username.
"defaultconnector": "msteams"
Mailto covers for original slurm e-mail sending functionality, plus a little bit more. With connector parameters, you can:
MailProg
, e.g. /usr/bin/mutt)/etc/Muttrc.local
# Local configuration for Mutt.
set content_type="text/html"
See annotated configuration example
Prerequisites for the mattermost connector:
--mail-user=mattermost:chatId
messages, can also be looked up by the user in the Info windowtriggerString
and send the user a private message with slurm job submission instructionsmattermost
block in goslmailer.conf (and optionally gobler.conf if spooling is used)Additional helpful sources:
Prerequisites for the discord connector:
triggerString
and send the user a private message with slurm job submission instructionshttps://discord.com/api/oauth2/authorize?client_id=<CLIENT-ID>&permissions=8&scope=bot
Or follow this tutorial
Sends 1on1 or group chat messages about jobs via telegram messenger app
Prerequisites for the telegram connector:
Site admins can create a telegram bot by messaging botfather.
Once the bot is created, you will receive a bot token
. Place the bot token
in the goslmailer/gobler config file in the telegram
connector section (see example below).
Start the tgslurmbot binary that serves as the bot.
When the chat/group chat with the bot is initiated and/or the bot receives a /start
command, he will reply with a chat-specific --mail-user=telegram:nnn
message which the user can use in his slurm job scripts to get the job messages.
See annotated configuration example
Sends messages to user-defined Matrix rooms.
The Matrix connector can send messages through a pre-defined user that you manually join into channels. In addition, you can setup matrixslurmbot to control this pre-defined user and have him join rooms upon invitation.
The first thing you need is to add the proper parameters to the connectors/matrix section of the config file.
To obtain the access token, you can run this command using curl:
curl -XPOST -d '{"type":"m.login.password", "user":"@myuser:matrix.org", "password":"mypassword"}' "https://matrix.org/_matrix/client/r0/login"
Which should get you a response akin to this one, containing the token:
{
"user_id": "@myuser:matrix.org",
"access_token": "syt_dGRpZG9ib3QXXXXXXXEyQMBEmvOVp_10Jm93",
"home_server": "matrix.org",
"device_id": "DMIIOMEYBK",
"well_known": {
"m.homeserver": {
"base_url": "https://matrix-client.matrix.org/"
}
}
}
Once you've done this, goslmailer will be able to send messages to any channel the configured user is a member of with a command like this:
sbatch --mail-type=ALL --mail-user='matrix:!VEbreVXXXkmLWjeGPi:matrix.org' --wrap "ls"
Where !VEbreVXXXkmLWjeGPi:matrix.org
is the ID of the channel you want to send
the message to. You can obtain this ID from the Settings>Advanced
section of
the room.
Instead of manually having the pre-defined user join certain rooms, you can use
matrixslurmbot
to control this user and have it join rooms automatically upon invitation.
For this you just need to start the matrixslurmbot
, pointing it to a config file identical to the one before using
(you could strip it down to contain only the 'matrix' section).
While the bot is running, any user can invite it to join a channel (e.g. /invite @mybotuser:matrix.org
). The bot will join the channel and post the
--mail-user:...
argument to be used when submitting jobs in order to receive a message in that
channel.
In the event that the pre-defined user is alone in a channel (i.e. all normal users left), the bot will make the pre-defined user leave and forget the channel.
Sends a message to a preconfigured ms teams channel webhook.
Since MS Teams does not provide with the option to send messages to users directly, only to channel webhooks, we have devised a way using MS Power Automate framework to pick up messages from this one configured sink channel and deliver them via private 1on1 chats to the recipient user.
Users listed in the --mail-user=msteams:userA,msteams:userB
will be sent as adaptive card mention entity.
A MS Power Automate workflow monitors the configured sink channel, parses the received adaptive card jsons, locates the mention
entity and delivers to it the copy of the message via private chat.
See annotated configuration example
Sends messages to direct messages or channels in Slack using its Web API and slack-go.
Prerequisite for the slack connector:
chat:write
and im:write
.xoxb-5555555555555-5555555555555-XXXXXXXXXXXXXXXXXXXXXXX
. This will be used in your goslmailer config (goslmailer.conf
or goslmailer.toml
), and gobler config if used.The bot will be able to send to any channel it's in. Make sure it is not added to channels it shouldn't send messages in (such as an announcments channel). You can add the bot to a channel by pinging it (send a message with just @SlurmBot, for example) and then click on Add to Channel.