Sometimes waiting for the completion of a task is not good enough.
If a task is producing several results, another task may start as
soon as the first results are ready.
For that, ecFlow introduces the concept of event
Events have names and a task can set several of them.
We will create new tasks (t3, t4) that will be triggered by the events emitted in task t2.
Create the ecf script
for t3 and t4 by copying t1.
echo "I will now sleep for %SLEEP% seconds"
ecflow_client --event=a # Set the first event
sleep %SLEEP% # Sleep a bit more
ecflow_client --event=b # Set the second event
sleep %SLEEP% # A last nap...
# Definition of the suite test.
edit ECF_INCLUDE "$HOME/course" # replace '$HOME' with the path to your home directory
edit ECF_HOME "$HOME/course"
edit SLEEP 20
trigger t1 eq complete
from ecflow import Defs,Suite,Family,Task,Edit,Trigger,Event
Trigger("t1 == complete"),
print("Creating suite definition")
home = os.path.join(os.getenv("HOME"), "course")
defs = Defs(
print("Checking job creation: .ecf -> .job0")
print("Saving definition to file 'test.def'")
What to do
- Update test.def or test.py
- Edit t2.ecf to call ecflow_client –event.
- Copy t1.ecf to t3.ecf and t4.ecf
- Replace the suite
python: python test.py; python client.py
text: ecflow_client --suspend=/test ; ecflow_client --replace=/test test.def
- Observe the tasks in ecflow_ui
- See the triggers by selecting t2/t3 and clicking on the trigger tab