Skip to content
This repository was archived by the owner on Jul 10, 2026. It is now read-only.

cemc-oper/light-ecflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

light-ecflow

Maturity-Archived

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.

Features

  • Pure Python, no C++ compiler or ecflow binary required.
  • Familiar API: Defs, Suite, Family, Task, Trigger, RepeatDate, Clock, etc.
  • Writes ecFlow-compatible .def text files.
  • Easy to install and extend.

Installation

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]"

Quick Start

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

Usage

Method-style API

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")

Constructor-style API

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"),
            )
        )
    )
)

Compound triggers

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)  # OR

The resulting trigger expression is:

t1 == complete or t4 == complete and t5 == active or t7 == active

Supported API

Nodes

  • Defs
  • Suite
  • Family
  • Task

Attributes

  • Edit
  • Trigger
  • PartTrigger
  • Complete
  • DefStatus
  • Event
  • Meter
  • Limit
  • InLimit
  • Time
  • RepeatDate
  • RepeatDay
  • Clock
  • DState

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.

Development

Run the test suite with pytest:

python -m pytest

License

light-ecflow is licensed under the Apache License 2.0. See LICENSE for details.

Acknowledgments

This project is inspired by the ECMWF ecFlow software. It is not affiliated with or endorsed by ECMWF.

About

A pure Python ecFlow API for generating ecFlow workflow definition (.def) files.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages