...
Python
For brevity we have left out family f1. In python this would be:
Code Block | ||||
---|---|---|---|---|
| ||||
#!/usr/bin/env python2.7
import os
from ecflow import Defs,Suite,Family,Task,Edit,Trigger,Complete,Event,Meter,Time,Day,Date
def create_family_f2():
return Family("f2",
Edit(SLEEP=20),
Task("t1", Time("00:30 23:30 00:30")), # start(hh:mm) end(hh:mm) increment(hh:mm)
Task("t2", Day("sunday")),
Task("t3", Date("1.*.*"), Time("12:00")), # Date(day,month,year) - * means every day,month,year
Task("t4", Time("+00:02")), # + means realative to suite begin/requeue time
Task("t5", Time("00:02"))) # 2 minutes past midnight
print("Creating suite definition")
home = os.path.join(os.getenv("HOME"), "course")
defs = Defs(
Suite("test",
Edit(ECF_INCLUDE=home,ECF_HOME=home),
create_family_f2()))
print(defs)
print("Checking job creation: .ecf -> .job0")
print(defs.check_job_creation())
print("Checking trigger expressions")
errors = defs.check()
assert len(errors) == 0,errors
print("Saving definition to file 'test.def'")
defs.save_as_defs("test.def") |
#!/usr/bin/env python2.7
import os
import ecflow
def create_family_f2():
f2 = ecflow.Family("f2")
f2.add_variable("SLEEP", 20)
f2.add_task("t1").add_time( "00:30 23:30 00:30" ) # start(hh:mm) end(hh:mm) increment(hh:mm)
f2.add_task("t2").add_day( "sunday" )
# for add_date(): day,month,year; here 0 means every month, and every year
t3 = f2.add_task("t3")
t3.add_date(1, 0, 0) # day month year, first of every month or every year
t3.add_time( 12, 0 ) # hour, minutes at 12 o'clock
f2.add_task("t4").add_time( 0, 2, True ) # hour, minutes, relative to suite start
# 2 minutes after family f2 start
f2.add_task("t5").add_time( 0, 2 ) # hour, minutes suite site
# 2 minutes past midnight
return f2
print "Creating suite definition"
defs = ecflow.Defs()
suite = defs.add_suite("test")
suite.add_variable("ECF_INCLUDE", os.path.join(os.getenv("HOME"), "course"))
suite.add_variable("ECF_HOME", os.path.join(os.getenv("HOME"), "course"))
suite.add_family( create_family_f1() )
suite.add_family( create_family_f2() )
print defs
print "Checking job creation: .ecf -> .job0"
print defs.check_job_creation()
print "Checking trigger expressions"
print defs.check()
print "Saving definition to file 'test.def'"
defs.save_as_defs("test.def")
What to do
- Make the changes to the suite definition file
- Create all the necessary ecf script‘s by copying the one from /test/f1/t7
- Replace the suite
python: python test.py; python client.py
text: ecflow_client --suspend=/test ; ecflow_client --replace=/test test.def - ecflow_ui has a special window to explain why a task is queued. Select a queued task and press the icon
or click on the 'Why tab'
...