18.1 Trigger Creation

18.1.1 Trigger Creation Syntax

Use the following format to create triggers:


18.1.2 Creating Triggers

Triggers can be created from both the configuration file and the command line. Triggers can be associated with an object such as a standing reservation, node, resource manager, or the scheduler when the object is instantiated. To do this, use the TRIGGER attribute with the associated object parameter, such as SRCFG (see Managing Reservations for more details), NODECFG, RMCFG, or SCHEDCFG.

To dynamically add a trigger to an existing object, use the mschedctl command. To add a trigger to an administrative reservation, use the mrsvctl command. Triggers may be added to jobs by specifying the trig resource manager extension when submitting the job through msub, as in the following example:


msub my.job -l 'trig=AType=exec\&Action="/jobs/my_trigger.pl"\&EType=create\&Offset=10:00'

Triggers can also be created on system jobs using the msub command, as shown in the following example. The benefit of system job triggers is that system jobs do not have to require any system resources. System jobs exist until manually cancelled or completed, a process that can be handled by scripts or trigger actions. This provides one means for creating standing triggers that fire at a specified time or when certain external dependencies are fulfilled.


echo true | msub -l flags=NORMSTART:NORESOURCES,trig=AType=exec\&Action="/tmp/action.sh"\&EType=start
echo true | msub -l flags=NORMSTART:NORESOURCES,trig=AType=exec\&Action=

For security reasons, only QoS with the trigger flag can have jobs with attached triggers. This can be set up by creating an appropriate QoS in the moab.cfg file.


QOSCFG[triggerok]  QFLAGS=trigger
USERCFG[user1]     QDEF=triggerok

In this example, a QoS named triggerok is created with the trigger flag. The user user1 is then added to this QoS. This user will then be able to attach triggers to jobs.

Please note that when creating job triggers via msub, "&" must be used to delimit the fields. All job triggers are removed when the associated job is cancelled.

18.1.3 Naming Triggers

By default, triggers are assigned a numeric ID by Moab. However, in many cases, managing triggers can become quite complicated if relying only on this ID. Therefore, users may assign an alphanumeric name up to 16 characters in length for each trigger. The Moab-assigned ID number is then appended to the end of the user-supplied name. The trigger name is specified at creation or modification using the Name trigger attribute.


msub my.job -l 'trig=Name=myTrigger\&AType=exec\&Action="/jobs/my_trigger.pl"\&EType=create\&Offset=10:00'

In this case, the new trigger attached to my.job will be named myTrigger.<TRIGID>, where <TRIGID> is the ID assigned automatically by Moab. This name will appear in the output of the mdiag -T command. Carefully chosen trigger names can greatly improve the readability of this output.

See Also

Copyright © 2012 Adaptive Computing Enterprises, Inc.®