#!/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)
|