17.0 Object triggers > How-to's > Creating a trigger

Conventions

17.1 Creating a trigger

To create a Moab trigger

  1. Choose an object to which, and a method by which, you will attach the trigger. Use the format and examples described in its corresponding documentation:

  2. If the trigger is to be attached to a job, you must first enable job triggers (see Enabling job triggers for more information.). Please carefully review the warning before doing so.

  3. Decide whether to attach the trigger via the command line or configuration file. Verify the correct syntax.
  4. Set the EType equal to whichever event will launch the trigger if and when it occurs on the object.

    Each object has a different lifecycle, so not every event type will occur on every object. For a list of valid ETypes for your selected object, see the corresponding object reference page linked in step 1.

    1. To modify the timing of the trigger in any of the following ways, see Event-modifying trigger components.
      • To set the trigger as rearmable and specify the amount of time the trigger must wait before firing again.
      • To set an amount of time before or after the event that the trigger will fire (See Offset for restrictions).
      • To set a specific threshold and the amount of time that the object must meet that threshold before the trigger will fire.
  5. Configure the action that the trigger will take when the event happens. To do so, you must set the AType to a valid value for your object and specify the action. For instance, to execute a script, set the AType to exec and the Action to the location of the script in quotation marks. Include the name of the object on which the script will run.
  6. NODECFG[node01] TRIGGER=EType=fail,AType=exec,Action="node.fail.sh node01"

    1. To modify the action in any of the following ways, see Action-modifying trigger components.
      • To specify environment variables available to the trigger
      • To set a flag on the trigger
        • To attach any stderr output generated by the trigger to the parent object
        • To destroy the trigger if its object ends or cancels
        • To tell Moab to checkpoint the trigger
        • To set the trigger as periodic
        • To pass the object's XML information to the trigger's stdin
        • To set the trigger to reset if its object is modified
        • To set the trigger to fire under the user ID of the object's owner
      • To specify an amount of time that Moab will suspend normal operation to wait for the trigger to execute
      • To allot an amount of time that the trigger will attempt to run before it is marked as unsuccessful and the process, if any exists, is killed
      • Set a maximum number of times that a trigger will attempt to fire before it fails
    2. To give the trigger a name or description, see Organizational trigger components.
    3. To configure the trigger to set or unset a variable when it fires or to require a variable to fire, see Setting and receiving trigger variables.

© 2014 Adaptive Computing