The following example shows how suites, families and tasks are added to a Python definition file.
import ecflow if _name_ == "_main_": defs = ecFlow.Defs() # create an empty definition suite = defs.add_suite("s1"); # create a suite and add it to the defs family = suite.add_family("f1") # create a family and add it to suite for i in [ "a", "b", "c" ]: # create task ta,tb,tc family.add_task( "t" + i) # create a task and add to family defs.save_as_defs("test.def") # save defs to file "test.def"
The following examples show alternative styles of adding suites,families and tasks: They produce exactly the same suite as the first.
from ecflow import * with Defs() as defs: with defs.add_suite("s1") as suite: with suite.add_family("f1") as family: for i in [ "a", "b", "c" ]: family.add_task( "t" + i) defs.save_as_defs("test.def") | from ecflow import * defs = Defs().add( Suite("s1").add( Family("f1").add( [ Task("t{}".format(t)) for t in ("a", "b", "c")]))) defs.save_as_defs("test.def") | from ecflow import * defs = Defs() defs += [ Suite("s1") ] defs.s1 += [ Family("f1") ] defs.s1.f1 += [ Task("t{}".format(t)) for t in ("a", "b", "c")] defs.save_as_defs("test.def") |