Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Horizontal Navigation Bar
Button Group

Button Hyperlink
titlePrevious
typestandard
urlhttps://software.ecmwf.int/wiki/display/ECFLOW/Add+another+task
Button Hyperlink
titleUp
typestandard
urlhttps://software.ecmwf.int/wiki/display/ECFLOW/Going+Further
Button Hyperlink
titleNext
typestandard
urlhttps://software.ecmwf.int/wiki/display/ECFLOW/Families

Sometimes you want a task to run at a given time, or to run every three hours,
or to run only on the first of the month, or on Mondays,...
For that ecFlow supports date and time dependencies.

...

date or day

Date dependencies can be specified using the date or the day keyword.
Date dependencies are always absolute, but wild cards can be used.

 

Code Block
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

 

 

cron

Cron dependencies can be specified using the cron keyword:

Code Block
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                 # every sunday and tuesday
cron -d 1,15                # every 1st and 15th of each month
cron -m 1 -d 1              # every first of January

A task can have several time and date dependencies. For example:

Code Block
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
 
The task will run on sunday’s and wednesday’s at 1am and 4pm, but only if
the day is the 1st or the 10th of the month.
Like trigger‘s, date and time dependencies can be set for a family.
In this case, the tasks of this family will only run according to these dependencies.

 

Note

All time related dependencies(like cron, time, today, date and day) are relative to the clock of the suite.

For more information, see Dates and Clocks

 

...

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.getenv("HOME") + "/course")
suite.add_variable("ECF_HOME",    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

  1. Make the changes to the suite definition file
  2. Create all the necessary ecf script‘s by copying the one from /test/f1/t7
  3. Load and begin the suite
  4. ecflowview has a special window to explain why a task is queued. Select a queued task and press the why icon

 

...

Horizontal Navigation Bar
Button Group

Button Hyperlink
titlePrevious
typestandard
urlhttps://software.ecmwf.int/wiki/display/ECFLOW/Add+another+task
Button Hyperlink
titleUp
typestandard
urlhttps://software.ecmwf.int/wiki/display/ECFLOW/Going+Further
Button Hyperlink
titleNext
typestandard
urlhttps://software.ecmwf.int/wiki/display/ECFLOW/Families