Adding a complete

There are cases where a task does not need to run, because a certain condition has been met. Considering that the condition can be signalled by an event, ecFlow provides the complete expression to handle this case. From the previous example, suppose that event t2:b indicates that task t2 did not manage to produce an expected result, and in this case there is no need to run task t4.

The complete expression keyword has a similar syntax to the trigger keyword but sets a task complete rather than running it.

When ecflow_server tries to start a task, it evaluates the trigger and the complete expression. If the complete condition evaluates to _true_, the task will be set as complete. This means that the complete evaluation takes precedence over the trigger evaluation.

A complete can be defined between tasks, between families, or both. A complete can be used in conjunction with a trigger, as follows.

Update Suite Definition

Update the suite definition to add a complete expression to task t4.

# Definition of the suite test.
suite test
   edit ECF_INCLUDE "{{HOME}}/course" # replace '{{HOME}}' appropriately
   edit ECF_HOME    "{{HOME}}/course"
   family f1
     edit SLEEP 20
     task t1
     task t2
         trigger t1 eq complete
         event a
         event b
     task t3
         trigger t2:a
     task t4
         trigger t2 eq complete
         complete t2:b
   endfamily
endsuite

What to do:

  1. Update the suite definition, as shown above.

  2. Replace the suite, using:

    ecflow_client --suspend /test
    ecflow_client --replace /test test.def
    
  3. Observe the tasks in ecflow_ui.

  4. See the triggers by selecting t4.

  5. See the trigger relation by clicking on the arrow.

  6. See the triggers in the tree, using the Show menu.

  7. Note the icon indicating that the task has not run.

  8. To check the triggers modify task t2 so that event b is not triggered; task t4 should run when t2 completes.