Versions Compared

Key

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

...

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 *
with
defs = Defs() 
as defs: with defs.add_suite
+ Suite("s1"
)
,
  
as
 
suite:
        
with
 
suite.add_family
Family("f1"
)
,
  
as
 
family:
           [ Task("t{0}".format(t)) for 
i
t in 
[
("a", "b", "c"
]: family.add_task( "t" + i)
)]))
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")     



The following example adds 5 suites, with 5 families with 5 tasks. However care needs to be taken, to ensure that python is readable. It is recommended that you check your results

...