time
time 23:00 # at next 23:00 time 10:00 20:00 01:00 # every hour from 10am to 8pm time +00:01 # one minute after the suite has begun time +00:10 01:00 00:05 # 10 to 60 minutes after begin every 5 minutes
In the last example we have task that runs every five minutes, however what happens if the task takes longer ?
When this happens, the time slot, is missed.
cron
Cron dependencies can be specified using the cron keyword. Cron differs from time as when the node is complete it queues again immediately. Cron also only works with a real time clock (not a hybrid clock).
cron 23:00 # every day at 23:00 cron 08:00 12:00 01:00 # every hour between 8 and 12 cron -w 0,2 11:00 # every sunday and tuesday at 11 am cron -d 1,15 02:00 # every 1st and 15th of each month at 2 am cron -m 1 -d 1 14:00 # every first of January at 2 pm
Time,Today,Cron
When a time has expired, the associated node is free to run. The time will stay expired, until the node is re-queued.
date or day
date 31.12.2012 # the 31st of December 2012 date 01.*.* # every first of the month date *.10.* # every day in October date 1.*.2008 # every first of the month, but only in 2008 day monday # every monday
Mixing time dependencies on the same node
A task can have several time and date dependencies. For example:
task tt day monday time 10:00 # run on Monday at 10:00. Here Day/date acts like a guard over the time.
task tt day sunday day wednesday date 01.*.* # The first of every month and year date 10.*.* # The tenth of every month and year time 01:00 time 16:00
Mixing time dependencies on different nodes
When time dependencies are placed on different nodes in the hierarchy, the results may seem surprising.
family fam day monday task tt time 10:00 # This will run on Monday at midnight, and Monday at 10 am ? family fam2 time 10:00 task tt day monday # This will run on Monday at midnight, and Monday at 10 am ?
The example above assume we have suite, with an infinite repeat loop. So why does the task run on Monday at midnight?
This is because time dependencies on different nodes act independently of each other. In this case time attribute was set free, on Sunday at 10 am. Hence at for task tt its free to run at Monday at midnight. After task has run and re-queued. It will then run on Monday at 10 am.
Text
# Definition of the suite test suite test edit ECF_INCLUDE "$HOME/course" # replace '$HOME' with the path to your home directory edit ECF_HOME "$HOME/course" family f2 edit SLEEP 20 task t1 time 00:30 23:30 00:30 task t2 day sunday task t3 date 01.*.* time 12:00 task t4 time +00:02 task t5 time 00:02 endfamily endsuite
Python
For brevity we have left out family f1. In python this would be:
#!/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
- Load and begin the suite
- ecflow_ui has a special window to explain why a task is queued. Select a queued task and press the icon