Versions Compared

Key

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

The following python code shows how to check expression and limits.
Checking existing definition file that has been saved as a file;

Code Block
 def = ecflow.Defs("/my/path.def") # will load file '/my/path.def' from disk

...


 print def.check() # check trigger expressions and limits


Here is another example where we create the suite definition on the fly. In fact using the python API allows for a correct by construction paradigm.

Code Block
 defs = ecflow.Defs() # create a empy defs

...


 suite = defs.add_suite("s1"); # create a suite 's1' and add to defs

...


 task = suite.add_task("t1"); # create a task 't1' and add to suite

...


 task.add_trigger("t2 == active)") # mismatched brackets

...


 result = defs.check(); # check trigger expressions and limits

...


 print "Message: '" + result + "'"

...


 assert len(result) != 0, "Expected Error: mis-matched brackets in expression."