Versions Compared

Key

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

...

Code Block
languagepy
titleAdd Limits/Inlimits
from ecflow import Defs,Suite,Task,Limit,InLimit

defs = Defs()
defs   += Suite("s1",
           Limit("limitName4", 10),              # name, maximum token
           Family("f1",
               InLimit("limitName4","/s1/f1",2), # limit name, path to limit, tokens consumed
 from the Limit
            [ Task("t{0}".format(t)) for t in range(1,4) ] ))

...


Code Block
languagepy
defs = Defs().add(
s1         Suite= defs.add_suite("s1") 
s1.add_limit(
           Limit("limitName4", 10 ),
  
f1         Family= s1.add_family("f1")
f1.add_inlimit(
             InLimit("limitName4","/s1/f1",2),
  
for i in range(1,4):
        [ Task(f1.add_task( "t{}".format(t)) 
                  for t in range(1,4) ]))i))



Code Block
languagepy
defs = Defs() + Suite("s1") 
defs.s1 += [ Limit("limitName4", 10),Family("f1") ]
defs.s1.f1 += [ InLimit("limitName4","/s1/f1",2),
                      [ Task("t{}".format(t)) 
                         for t in range(1,4) ] ]



Code Block
languagepy
with Defs() as defs:
   with defs.add_suite("s1") as s1:
      s1.add_limit( "limitName4", 10 ) 
          with s1.add_family("f1") as f1:
              f1.add_inlimit( "limitName4","/s1/f1",2)  
              f1 += [ Task("t{}".format(t)) 
                         for t in range(1,4) ]



Warning

In the second example above we use 'defs.s1.f1' 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.