Code Block | ||
---|---|---|
| ||
from ecflow import Defs,Suite,Family,Task,RepeatDay,RepeatEnumerated,RepeatString,RepeatInteger,RepeatDateList def add_tasks(fam): for i in range(1,3): fam.add_task(Task("t{}".format(i))) defs = Defs() s1 = defs.add_suite("s1") f1 = s1.add_family("f1") f1f = ecflow.Family("f") f.add_repeat( ecflow.RepeatDate("YMD",20100111,20100115,2) ) f1add_tasks(f1) f2 = ecflows1.Familyadd_family("f1f2") f1f2.add_repeat( ecflow.RepeatInteger("count",0,100,2) ) f2add_tasks(f2) f3 = ecflows1.Familyadd_family("f2f3") color_list = f3.add_repeat( RepeatEnumerated("enum",["red", "green", "blue" ] ) ) add_tasks(f3) f2 f4 = s1.add_family("f4") f4.add_repeat(ecflow.RepeatEnumerated RepeatString("enum",color_list) ) task6 = ecflow.Task("t6").add_repeat( RepeatString("R", ["a","b","c"]))["a", "b", "c" ] ) ) add_tasks(f4) f5 = s1.add_family("f5") f5.add_repeat( RepeatDay(1) ) add_tasks(f5) f6 = s1.add_family("f6") f6.add_repeat( RepeatDateList("YMD",[20130101, 20130102, 20130103 ]) ) # arbitary date list add_tasks(f6) |
The following examples show alternative styles that produces the same definition:
|
|
Warning |
---|
In the second example above we use 'defs.s1.*' to reference a node by name. This is useful in small designs but will produce maintenance issues in large designs IF the node names are changed. |