from ecflow import Defs,Suite,Task,Trigger,Complete defs = Defs() s1 = defs.add_suite("s1") t1 = s1.add_task("t1") t2 = s1.add_task("t2") t2.add_trigger( "t1 == active and t3 == aborted" ) t2.add_complete( "t3 == complete" ) t3 = s1.add_task("t3") |
The following examples show alternative styles that produce the same definition:
|
|
Adding triggers like '<nodepath> == complete' is extremely common. Hence there are a few short cuts;
task = Task("task") # Using a trigger with a 'list' argument, each string/node element converted to <name> == complete t = Trigger(["a","b",task]) # because Task("task") does *NOT* have a parent, we will use the name assert str(t) == "a == complete AND b == complete AND task == complete","Trigger not as expected: " + str(t)) defs = Defs() task = defs.add_suite("s").add_family("f").add_task("task") t = Trigger(["a","b",task]) # Task('task') has a parent hierarchy, hence we use full path in trigger expression assert str(t) == "a == complete AND b == complete AND /s/f/task == complete", "Trigger not as expected: " + str(t)) |
There are many times where we want to add a chain of task, i,e where task must be run sequentially one after the other. The following examples show different styles of chaining tasks which are identical:
|
|
|