You are here: 17 Object Triggers > Trigger Variables > How-to > Exporting Variables to Parent Objects

17.24 Exporting Variables to Parent Objects

To export variables to parent objects

  1. When setting a variable, indicate that the variable is to be exported to the parent object by using a caret (^).
  2. AType=exec,Action="/tmp/trigger1.sh",EType=start,Sets=Var1.!^Var2

    Atype=exec,Action="/tmp/trigger2.sh",EType=start,Requires=Var1

    AType=exec,Action="/tmp/trigger3.sh",EType=start,Requires=Var2

    Var2 is exported to the parent object if the trigger fails. It can be used by job and reservation triggers at the same level or by parent objects.

  3. Optional: if running a script, you can set a variable as a string to pass up to the parent object.
    1. Set the variable to pass up to the parent object with the caret (^). Use the exec AType to run a script.
    2. AType=exec,Action="/tmp/trigger.sh",EType=start,Sets=^Var1

      The trigger sets Var1 when it completes successfully. Because the trigger launches a script, a string value can be set for Var1.

    3. Declare the variable's string value on its own line in the trigger stdout.
    4. EXITCODE=15
      Var1=linux

      Var1 has the value of linux and is passed up to the parent object. This is useful in workflows in which a trigger may depend on the value given by a previous trigger.

      To return multiple variables, simply print out one per line.

© 2016 Adaptive Computing