Important
This project has been archived and is no longer maintained. It is kept available for historical reference.
Please use cemc-oper/takflow instead.
A pure-Python, lightweight replacement for the ecflow Python API used to generate ecFlow workflow definition files (.def).
The official ecflow Python package is a C++ extension that can be difficult to install in some environments.
light-ecflow provides the small subset of the API that is needed to build suites and write .def files, with no native dependencies.
- Pure Python, no C++ compiler or ecflow binary required.
- Familiar API:
Defs,Suite,Family,Task,Trigger,RepeatDate,Clock, etc. - Writes ecFlow-compatible
.deftext files. - Easy to install and extend.
Install from source in editable mode:
git clone <repository-url>
cd light-ecflow
pip install -e .To install the development dependencies as well:
pip install -e ".[dev]"from light_ecflow import Defs, Suite, Family, Task, Trigger
defs = Defs(
Suite("my_suite",
Family("my_family",
Task("t1"),
Task("t2", Trigger("t1 == complete")),
)
)
)
defs.save_as_defs("my_suite.def")This produces:
suite my_suite
family my_family
task t1
task t2
trigger t1 == complete
endfamily
endsuite
from light_ecflow import Suite, Family, Task, RepeatDate
suite = Suite("oper")
family = suite.add_family(Family("main"))
task = family.add_task(Task("forecast"))
task.add_repeat(RepeatDate("YMD", 20240101, 20240131))
task.add_trigger("obs == complete")from light_ecflow import (
Defs, Suite, Family, Task,
Edit, Trigger, RepeatDate, Clock, DState,
)
defs = Defs(
Suite("oper",
Clock(True),
DState.queued,
Edit(ECF_HOME="/path/to/home"),
Family("main",
Task("forecast",
RepeatDate("YMD", 20240101, 20240131),
Trigger("obs == complete"),
)
)
)
)A node can only have one trigger.
Use add_part_trigger to build a compound expression:
task = Task("t2")
task.add_trigger("t1 == complete or t4 == complete")
task.add_part_trigger("t5 == active", True) # AND
task.add_part_trigger("t7 == active", False) # ORThe resulting trigger expression is:
t1 == complete or t4 == complete and t5 == active or t7 == active
DefsSuiteFamilyTask
EditTriggerPartTriggerCompleteDefStatusEventMeterLimitInLimitTimeRepeatDateRepeatDayClockDState
Only the features needed to generate .def files are implemented.
Advanced ecFlow runtime features such as cron, autocancel, and zombie handling are out of scope.
Run the test suite with pytest:
python -m pytestlight-ecflow is licensed under the Apache License 2.0.
See LICENSE for details.
This project is inspired by the ECMWF ecFlow software. It is not affiliated with or endorsed by ECMWF.