Versions Compared

Key

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

...

This python segment show how to load a text based suite definition(cron.def) and simulate it in python.

Code Block
languagepy
titleHow to simulate a text based definition
import ecflow
defs = Defs("cron,def")
result = defs.simulate()    
assert len(result) == 0,  "Expected simulation to return without any errors, but found:\n" + result

...

This simulation is expected to fail, since we have a deadlock/ race condition


Code Block
suite dead_lock
  family family
    task t1
      trigger t2 == complete
    task t2
      trigger t1 == complete
  endfamily
endsuite



Code Block
languagepy
titlesiumuate a deadlock. Create definition in python
import ecflow
defs = ecflow.Defs().add(
	     Suite("dead_lock").add(
            Family("family").add(
               Task("t1").add( Trigger(t2 == complete)),
               Task("t2").add( Trigger(t1 == complete)))))

theResult = defs.simulate(); # simulate the definition
assert len(theResult) != 0, "Expected simulation to return errors" 
print theResult