ecFlow's documentation is now on readthedocs!

The ecflow server records all commands sent to it, in a log file (<host>.<port>.ecf.log)

This log file will grow over time to a considerable size.

In this exercise, we will create a task, whose job is to periodically back up and clear this log file.

This will be done with cron attribute introduced in the previous page. A cron will run indefinitely. i.e. once it has completed it will automatically re-queue itself.

For more examples of adding a cron see the user manual and ecFlow Python Api

Ecf Script

We will create a new script, clear_log.ecf

%include <head.h>

# copy the log file to the ECF_HOME/log directory
cp %ECF_LOG% %ECF_HOME%/log/.
# clear the log file
ecflow_client  --log=clear

%include <tail.h>


For brevity, the previous families have been omitted.

# 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 house_keeping
     task clear_log
       cron -w 0 22:30  # run every Sunday at 10:30pm


For brevity, the previous families have been omitted.

import os
from ecflow import Defs,Suite,Family,Task,Edit,Trigger,Complete,Event,Meter,Cron
def create_family_house_keeping():
    return Family("house_keeping",
print("Creating suite definition")  
home = os.path.join(os.getenv("HOME"), "course")
defs = Defs( 
print("Checking job creation: .ecf -> .job0")  
print("Checking trigger expressions")
errors = defs.check()
assert len(errors) == 0,errors

print("Saving definition to file 'test.def'")

What to do

  1. Make the changes to the suite definition file
  2. Create all the necessary ecf script‘s 
  3. Replace the suite
    python:  python3; python3
    text:       ecflow_client --suspend=/test  ;  ecflow_client --replace=/test  test.def
  4. ecflow_ui  has a special window to explain why a task is queued. Select a queued task and  click on the 'Why tab'
  5. Manually run the task. Examine the log file on disk.