ecFlow's documentation is now on readthedocs!
suite definition and replace
#!/usr/bin/env python
import sys, os; path = "/home/ma/emos/def/o/def"; sys.path.append(path)
import ecf; from ecf import (
    Autocancel, Client, Clock, Complete,
    Cron, Date, Day, Defs, Defstatus, Edit, Event, Extern, Family,
    Inlimit, Label, Late, Limit, Meter, Node, Repeat, Suite, Task, Time,
    Today, Trigger)
HOME = os.environ['HOME'] + '/course'
SUITE = os.getenv("SUITE", "test")
NODE = '/' + SUITE


# WRONG? no repeat, dates/time would not allow looping
def create(): return Suite(SUITE).add(
    Defstatus("suspended"),
    Limit("total", 2),
    Inlimit("total"), # !!!
    Edit(ECF_INCLUDE=HOME,  # header files
         ECF_FILES=HOME,  # task wrappers .ecf
         ECF_HOME=HOME,   # job + local output files
       ),
    Family("f1").add(
        Task("t1").add(
            Meter("step", -1, 100)),
        Task("t2").add(
          Meter("step", -1, 100),
          Event("a"),
          Event("b"),
          Trigger("t1:step gt 0")),
        Task("t3").add(
          Trigger("t2:a")),
      Task("t4").add(
        Complete("t2:b"),
        Trigger("t2 eq complete and not t2:b"))),
    Family("f2").add(
      Task("t1").add(
        Time("00:30 23:30 00:30")),
      Task("t2").add(
        Day("sunday")),
      Task("t3").add(
        Time("12:00"),
        Date("1.*.*")),
      Task("t4").add(
        Time("+00:02")),
      Task("t5").add(
        Time("00:02"))))


if __name__ == "__main__":
  client = Client(os.getenv('ECF_HOST', 'localhost'),
                  os.getenv('ECF_PORT', '31415'));
  defs=Defs()
  suite=create()
  if 0:
      import limit, limit2, fif, ffor, case;
      suite.add(
          limit.family_limit(),
          limit2.family_limit(),
          fif.family_if(),
          ffor.family_for(),
          case.family_case())
  defs.add_suite(suite)
  client.replace(NODE, defs)


suite-env.sh
#!/bin/bash
# aka $HOME/.ecflowrc/ecflowrc
export ECF_PORT=$(($(id -u)+1500)) ECF_HOST=$(uname -n)
client="ecflow_client --port=$ECF_PORT --host=$ECF_HOST"
alias replace="$client --replace"
alias load="$client --load"

commands="autocancel clock complete cron date day defstatus edit 
event family inlimit label late limit meter repeat suite task today
trigger endfamily endsuite endtask extern " # keywords
exec 3> ${SUITE:=test}.exp # expended def-file will be created
for fname in $commands; do source /dev/stdin <<@@
$fname() { echo $fname \${*} >&3; }
@@
done
alias time="echo time \${*} >&3"
suite example
#!/bin/bash
. suite-env.sh; ECF_HOME=$HOME/course
extern /limits:hpc
# suite limits; limit hpc 100; endsuite
suite ${SUITE:=test}
edit ECF_INCLUDE $ECF_HOME; edit ECF_FILES $ECF_HOME; # r-x
edit ECF_HOME $ECF_HOME  # rwx
  defstatus suspended; limit lim 2; inlimit lim; edit SLEEP 20
  . for.def; . if.def ; . case.def ; . trigger.def # external def
  family f1    
    task t1; meter step -1 100; # endtask # optional
    task t2; trigger t1:step gt 0; meter step -1 100; event a; event b
    task t3; trigger t2:a
    task t4; complete t2:b; trigger "t2 eq complete and not t2:b"
  endfamily;
  family f2
    for i in $(seq 1 5); do task t$i; case $i in 1)time 00:30 23:30 00:30;;
    2)day sunday;; 3)time 12:00; date 1.*.*;; 4)time +00:02;; 5)time 00:02;;
    esac; done
# endfamily # f2 # endsuite # SUITE # not necessary at the end!