Versions Compared

Key

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

...

Box B. Checking

Expression checking

Some checking has to be deferred until the definition is fully defined. Here is a simple example showing the checking of trigger expressions:

Code Block
languagepython
import ecflow
defs = ecflow.Defs() 
suite = defs.add_suite("s1");
suite.add_task("t2") 
suite.add_task("t1").add_trigger("t2 == active)") 
assert len(defs.check()) != 0, "Expected Error: miss-matched brackets in expression." 

 

Job checking

Job creation is the process of locating an '.ecf' script corresponding to a task and then generating a job file. This can be checked before a definition is loaded into the server using the Python API.

Code Block
languagepython
# Generate jobs for the ALL tasks in the definition given by variable 'defs' 
# and print errors to standard out. 
import ecflow 
defs = ecflow.Defs() 
suite = defs.add_suite("s1"); 
suite.add_task("t1") 
ob_ctrl = JobCreationCtrl() 
print defs.check_job_creation( job_ctrl ) 
print job_ctrl.get_error_msg() 



Job control provides additional functionality to control which nodes are generated and control over the directory used for job generation.

Dead lock checking

Simulation allows a suite definition to be checked without the need for scripts or a server. By default the simulation will run for a year before quitting. This can take a couple a seconds to a few minutes depending on the complexity of the suite definition. However, it is most useful where we have a definition which is known to complete. Here is an example which will cause a deadlock that is detectable by the simulator.

Code Block
languagepython
import os from ecflow import *
defs = Defs() 
suite = defs.add_suite("dead_lock") 
fam = suite.add_family("family") 
fam.add_task("t1").add_trigger("t2 == complete") 
fam.add_task("t2").add_trigger("t1 == complete")
theResult = defs.simulate()
assert len(theResult) != 0, "Expected simulation to return errors, but found none" print theResult
os.remove("defs.depth") # provides reason why simulation could not complete 
os.remove("defs.flat")  # provides reason why simulation could not complete 



Early checking of the suite definition will help to speed up the development of suites.

...