Please note that after the first part trigger has been added, subsequent part triggers must include a boolean to indicate whether the part expression is to be 'anded' or 'ored'
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") t3 = s1.add_task("t3") t3.add_part_trigger( "t1 == complete") t3.add_part_trigger( "t2 == active", True) # here True means add as 'AND' t3.add_part_trigger( "t2 == aborted", False) # here False means add as 'OR'
t3 TRIGGER
(t1 == complete and t2 == active or t2 == active)
The following show alternative styles that produce the the same definition:
defs = Defs().add( Suite("s1").add( Task("t1"), Task("t2"), Task("t3").add( Trigger("t1 == complete"), Trigger("t2 == active"), Trigger("t2 == aborted",False), ))) | defs = Defs() + Suite("s1") defs.s1 += [ Task("t{}".format(i)) for i in range(1,4) ] defs.s1.t3 += [ Trigger("t1 == complete"), Trigger("t2 == active"), Trigger("t2 == aborted",False) ] |