...
Code Block |
---|
language | py |
---|
title | Short cut for <node> == complete |
---|
|
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. The following examples show different styles of chaining tasks which are identical:
Code Block |
---|
| from ecflow import *
defs = Defs() + Suite("s1")
defs.s1 += [ Task("t1"),Task("t2"),Task("t3"),Task("t4") ]
defs.s1.t2 += Trigger( "t1 == complete" )
defs.s1.t3 += Trigger( "t2 == complete" )
defs.s1.t4 += Trigger( "t3 == complete" ) |
|
Code Block |
---|
| from ecflow import *
defs.s1 += [ Task("t1"),Task("t2"),Task("t3"),Task("t4") ]
defs.s1.t2 += Trigger( ["t1"] )
defs.s1.t3 += Trigger( ["t2"] )
defs.s1.t4 += Trigger( ["t3"] ) |
|
Code Block |
---|
| from ecflow import *
defs = Defs() + (Suite("s1") +
Task("t1") >> Task("t2") >> Task("t3") >> Task("t4")) |
|