strigger(1)
πΈ NAME πΈ
okay bestie, this is strigger(1) from the Slurm Commands crew β the tool that sets, gets, or clears Slurm trigger info. Triggers are little event watchers: a node fails, a job hits its time limit, a job terminates, etc., and they can fire off actions like running an arbitrary script. Typical uses include notifying system administrators about node failures and gracefully terminating a job when its time limit is approaching. You pass a hostlist expression for the nodelist or a job ID as an argument. event-driven Slurm behavior π
β¨ SYNOPSIS β¨
strigger --set [OPTIONS...]
strigger --get [OPTIONS...]
strigger --clear [OPTIONS...]
π¦ DESCRIPTION π¦
bestie, strigger is used to set, get or clear Slurm trigger information. Triggers include events such as a node failing, a job reaching its time limit or a job terminating. These events can cause actions such as the execution of an arbitrary script. Typical uses include notifying system administrators of node failures and gracefully terminating a job when its time limit is approaching. A hostlist expression for the nodelist or job ID is passed as an argument to the program.
Trigger events are not processed instantly β a check is performed for trigger events on a periodic basis, currently every 15 seconds. Any trigger events which occur within that interval will be compared against the trigger programs set at the end of the time interval. The trigger program will be executed once for any event occurring in that interval. The record of those events (e.g. nodes which went DOWN in the previous 15 seconds) will then be cleared. The trigger program must set a new trigger before the end of the next interval to ensure that no trigger events are missed OR the trigger must be created with an argument of --flags=PERM. If desired, multiple trigger programs can be set for the same event.
β οΈ NOTE: This command can only set triggers if run by the userSlurmUserunlessSlurmUseris configured as userroot. This is required for theslurmctlddaemon to set the appropriate user and group IDs for the executed program. Also note that the trigger program is executed on the same node that theslurmctlddaemon uses rather than some allocated compute node. To check the value ofSlurmUser, run the command:
scontrol show config | grep SlurmUser
π ARGUMENTS π
okay, hereβs the full flag menu β every option, no skips, periodt π
-C,--backup_slurmctld_assumed_controlβ Trigger event when backupslurmctldassumes control.-B,--backup_slurmctld_failureβ Trigger an event when the backupslurmctldfails.-c,--backup_slurmctld_resumed_operationβ Trigger an event when the backupslurmctldresumes operation after failure.--burst_bufferβ Trigger event when burst buffer error occurs.--clearβ Clear or delete a previously defined event trigger. The--id,--jobidor--useroption must be specified to identify the trigger(s) to be cleared. Only userrootor the trigger's creator can delete a trigger.-M,--clusters=<string>β Clusters to issue commands to. Note that theslurmdbdmust be up for this option to work properly, unless running in a federation withFederationParameters=fed_displayconfigured.-d,--downβ Trigger an event if the specified node goes into aDOWNstate.-D,--drainedβ Trigger an event if the specified node goes into aDRAINEDstate.--drainingβ Trigger an event if the specified node goes into aDRAININGstate, before it isDRAINED.-F,--failβ Trigger an event if the specified node goes into aFAILINGstate.-f,--finiβ Trigger an event when the specified job completes execution.--flags=<flag>β Associate flags with the reservation. Multiple flags should be comma separated. Valid flags include:PERMβ Make the trigger permanent. Do not purge it after the event occurs.
--getβ Show registered event triggers. Options can be used for filtering purposes.-i,--id=<id>β Trigger ID number.-I,--idleβ Trigger an event if the specified node remains in anIDLEstate for at least the time period specified by the--offsetoption. This can be useful to hibernate a node that remains idle, thus reducing power consumption.-j,--jobid=<id>β Job ID of interest. ASLUIDmay also be used in place of a numeric job ID. TheRES_IDis stored as specified. If aSLUIDis used to set a trigger, the trigger must be queried or cleared using the sameSLUID, not the numeric job ID (and vice versa). NOTE: The--jobidoption can not be used in conjunction with the--nodeoption. When the--jobidoption is used in conjunction with the--upor--downoption, all nodes allocated to that job will considered the nodes used as a trigger event.-n,--node[=host]β Host name(s) of interest. By default, all nodes associated with the job (if--jobidis specified) or on the system are considered for event triggers. NOTE: The--nodeoption can not be used in conjunction with the--jobidoption. When the--jobidoption is used in conjunction with the--up,--downor--drainedoption, all nodes allocated to that job will considered the nodes used as a trigger event. Since this option's argument is optional, for proper parsing the single letter option must be followed immediately with the value and not include a space between them. For example"-ntux"and not"-n tux".-N,--noheaderβ Do not print the header when displaying a list of triggers.-o,--offset=<seconds>β The specified action should follow the event by this time interval. Specify a negative value if action should preceded the event. The default value is zero if no--offsetoption is specified. The resolution of this time is about 20 seconds, so to execute a script not less than five minutes prior to a job reaching its time limit, specify--offset=320(5 minutes plus 20 seconds).-h,--primary_database_failureβ Trigger an event when the primary database fails. This event is triggered when the accounting plugin tries to open a connection withmysqland it fails and theslurmctldneeds the database for some operations.-H,--primary_database_resumed_operationβ Trigger an event when the primary database resumes operation after failure. It happens when the connection tomysqlfrom the accounting plugin is restored.-g,--primary_slurmdbd_failureβ Trigger an event when the primaryslurmdbdfails. The trigger is launched byslurmctldin the occasions it tries to connect toslurmdbd, but receives no response on the socket.-G,--primary_slurmdbd_resumed_operationβ Trigger an event when the primaryslurmdbdresumes operation after failure. This event is triggered when opening the connection fromslurmctldtoslurmdbdresults in a response. It can happen also in different situations, periodically every 15 seconds when checking the connection status, when saving state, when agent queue is filling, and so on.-e,--primary_slurmctld_acct_buffer_fullβ Trigger an event when primaryslurmctldaccounting buffer is full.-a,--primary_slurmctld_failureβ Trigger an event when the primaryslurmctldfails.-b,--primary_slurmctld_resumed_controlβ Trigger an event when primaryslurmctldresumes control.-A,--primary_slurmctld_resumed_operationβ Trigger an event when the primaryslurmctldresuming operation after failure.-p,--program=<path>β Execute the program at the specified fully qualified pathname when the event occurs. You may quote the path and include extra program arguments if desired. The program will be executed as the user who sets the trigger. If the program fails to terminate within 5 minutes, it will be killed along with any spawned processes.-Q,--quietβ Do not report non-fatal errors. This can be useful to clear triggers which may have already been purged.-r,--reconfigβ Trigger an event when the system configuration changes. This is triggered when theslurmctlddaemon reads its configuration file or when a node state changes.-R,--resumeβ Trigger an event if the specified node is set to theRESUMEstate.--setβ Register an event trigger based upon the supplied options. NOTE: An event is only triggered once. A new event trigger must be set established for future events of the same type to be processed. Triggers can only be set if the command is run by the userSlurmUserunlessSlurmUseris configured as userroot.-t,--timeβ Trigger an event when the specified job's time limit is reached. This must be used in conjunction with the--jobidoption.-u,--upβ Trigger an event if the specified node is returned to service from aDOWNstate.--user=<user_name_or_id>β Clear or get triggers created by the specified user. For example, a trigger created by userrootfor a job created by useradamcould be cleared with an option--user=root. Specify either a user name or user ID.-v,--verboseβ Print detailed event logging. This includes time-stamps on data structures, record counts, etc.-V,--versionβ Print version information and exit.
π OUTPUT FIELD DESCRIPTIONS π
when you peek at the output, these are the fields, bestie π«Ά
TRIG_IDβ Trigger ID number.RES_TYPEβ Resource type:jobornode.RES_IDβ Resource ID: job ID or host names or"*"for any host.TYPEβ Trigger type:timeorfini(for jobs only),downorup(for jobs or nodes), ordrained,idleorreconfig(for nodes only).OFFSETβ Time offset in seconds. Negative numbers indicated the action should occur before the event (if possible).USERβ Name of the user requesting the action.PROGRAMβ Pathname of the program to execute when the event occurs.
π₯ PERFORMANCE π₯
Executing strigger sends a remote procedure call to slurmctld. If enough calls from strigger or other Slurm client commands that send remote procedure calls to the slurmctld daemon come in at once, it can result in a degradation of performance of the slurmctld daemon, possibly resulting in a denial of service.
β οΈ Do not runstriggeror other Slurm client commands that send remote procedure calls toslurmctldfrom loops in shell scripts or other programs. Ensure that programs limit calls tostriggerto the minimum necessary for the information you are trying to gather.
πΈ ENVIRONMENT VARIABLES πΈ
okay so bestie, some strigger options can be set through environment variables instead of typing them every time β very "set it and forget it" of them π
Here's the lineup, matched with the options they correspond to:
heads up though β command line options will always override these settings. every single time. no cap. π
SLURM_CONFβ tells you where the Slurm configuration file lives. that's it, that's the whole vibe πSLURM_DEBUG_FLAGSβ lets you specify debug flags forstriggerto use. wanna see the full list of flags? check outDebugFlagsin theslurm.conf(5)man page. and noteworthy: this environment variable takes precedence over the setting inslurm.confβ so what you put here wins, periodt π
β¨ EXAMPLES β¨
this is the part where it gets good β real scenarios, real scripts, main character energy only π¦
π Example the first: the primary slurmctld says goodbye
execute the program "/usr/sbin/primary_slurmctld_failure" whenever the primary slurmctld fails. like, the moment it goes down, boom, script fires π₯
$ cat /usr/sbin/primary_slurmctld_failure
#!/bin/bash
# Submit trigger for next primary slurmctld failure event
strigger --set --primary_slurmctld_failure \
--program=/usr/sbin/primary_slurmctld_failure
# Notify the administrator of the failure using e-mail
/bin/mail slurm_admin@site.com -s Primary_SLURMCTLD_FAILURE
$ strigger --set --primary_slurmctld_failure \
--program=/usr/sbin/primary_slurmctld_failure
π Example the second: a node went down, tell the admin
execute the program "/usr/sbin/slurm_admin_notify" whenever any node in the cluster goes down. and the cute detail here: the subject line will include the node names which have entered the down state β and those get passed as an argument to the script by Slurm. iykyk π«Ά
$ cat /usr/sbin/slurm_admin_notify
#!/bin/bash
# Submit trigger for next event
strigger --set --node --down \
--program=/usr/sbin/slurm_admin_notify
# Notify administrator using by e-mail
/bin/mail slurm_admin@site.com -s NodesDown:$*
$ strigger --set --node --down \
--program=/usr/sbin/slurm_admin_notify
π¦ Example the third: idle nodes get suspended
execute the program "/usr/sbin/slurm_suspend_node" whenever any node in the cluster remains in the idle state for at least 600 seconds. nap time, bestie π΄
$ strigger --set --node --idle --offset=600 \
--program=/usr/sbin/slurm_suspend_node
π Example the fourth: clean up before the time limit hits
execute the program "/home/joe/clean_up" when job 1234 is within 10 minutes of reaching its time limit. note the -600 β negative offset, clock's ticking backwards β°
$ strigger --set --jobid=1234 --time --offset=-600 \
--program=/home/joe/clean_up
π Example the fifth: a node in the job died
execute the program "/home/joe/node_died" when any node allocated to job 1234 enters the DOWN state. rip to that node π
$ strigger --set --jobid=1234 --down \
--program=/home/joe/node_died
β Example the sixth: show me everything about job 1235
show all triggers associated with job 1235. look at that little table, she's serving β¨
$ strigger --get --jobid=1235
TRIG_ID RES_TYPE RES_ID TYPE OFFSET USER PROGRAM
123 job 1235 time -600 joe /home/bob/clean_up
125 job 1235 down 0 joe /home/bob/node_died
π Example the seventh: bye bye trigger 125
delete event trigger 125. gone. deleted. not me sweeping the timeline π§Ή
$ strigger --clear --id=125
πΈ Example the eighth: do the thing when the job finishes
execute /home/joe/job_fini upon completion of job 1237. the finale π¬
$ strigger --set --jobid=1237 --fini --program=/home/joe/job_fini
π COPYING π
okay the legal bit β read it, it's literally required, and honestly royalty behavior for legal text π«Ά
Copyright (C) 2007 The Regents of the University of California.
Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
Copyright (C) 2008-2010 Lawrence Livermore National Security.
Copyright (C) 2010-2022 SchedMD LLC.
This file is part of Slurm, a resource management program. For details, see <https://slurm.schedmd.com/>.
Slurm is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
Slurm is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
that's the all-caps "WITHOUT ANY WARRANTY" part, bestie β it's giving serious, so don't skip it. no warranty, no promises, fr fr. π
π§ SEE ALSO π§
go read these next, they're the friend group of this page, all iconic, all worth your time:
and that's a wrap on strigger(1), bestie π this page is from Slurm 26.05 in the Slurm Commands section β so go forth, set those triggers, and slay responsibly πβ¨π¦
π¦ where this page comes from
- arch rolling: slurm-llnl 26.05.5.1-1 Β· GPL-2.0-or-later
- epel 10: slurm 26.05.5-1.el10_3 Β· GPL-2.0-or-later AND BSD-2-Clause AND BSD-1-Clause
- nixpkgs unstable: slurm 26-05-5-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms