Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Defs, Suite,Family and Task from a node hierarchy: Every Suite,Family and Task must have a name. This name must be unique between the peers.

The following example show different ways of adding node hierarchy.


Code Block
import ecflow
defs = ecflow.Defs()
s = ecflow.Suite('s1')
f = ecflow.Family('f1')
t = ecflow.Task('t1')
defs.add_suite(s)
s.add_suite(f)
f.add_task(t)



Code Block
languagepy
titleUsing Add
import ecflow
defs = ecflow.Defs()
defs.add(
  Suite('s1').add(
   Family('f1').add(
      Task('t1'))))






The following example shows how suites, families and tasks are added to created in a Python definition file.

Code Block
languagepy
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.


Code Block
languagepy
from ecflow import *
defs = Defs(
        Suite("s1",
            Family("f1",
              [ Task("t{0}".format(t)) for t in ("a", "b", "c")])))
defs.save_as_defs("test.def")    



Code Block
languagepy
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")    



Code Block
languagepy
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")     


...