How ecmwf/ecflow works
Project type and purpose
• ecFlow is a full-stack, client/server workflow system written in C++ with multiple language bindings, a Qt-based GUI, HTTP/REST and UDP interfaces, and command-line tools.
• It orchestrates the execution of suites of tasks with dependencies and time triggers, provides fault tolerance and restart, and is used at ECMWF for operational workflows.
High-level file-structure analysis
• Top-level directories:
• libs/… – C++ libraries organizing core domain (core, node, attribute), client logic, server logic, REST, UDP, services, tests.
• Viewer/… – Qt GUI application and its accompanying libViewer for socket communication.
• 3rdparty/… – vendored dependencies (cereal, httplib, nlohmann/json).
• libs/pyext/… – Python bindings and samples.
• tools/… – shell/python scripts and utilities.
• releng/… – CI/CD and container orchestration.
• docs/… – Sphinx documentation, REST API specs, tutorials.
• CMakeLists.txt, CMakePresets.json – build configuration.
a. Main components:
1. Server
– Protocol layers:
• TCP/SSL server (libs/server)
• HTTP/REST server (libs/rest using httplib + JSON)
• UDP interface (libs/udp)
– Core engine: request dispatch, command execution (libs/base, libs/core, libs/node)
– Persistence: checkpoint saver (writing defs to disk), periodic scheduler
– Services: aviso (etcd client), mirror, executor plugin framework (libs/service)
2. Clients
– CLI client (ecflow client tool using libs/client over TCP/SSL)
– Python API (pyext bindings exposing client + core + node)
– Qt GUI (“ecflowUI” in Viewer/ecflowUI) connecting via libViewer sockets to a local helper that proxies to server over TCP
– REST clients (any HTTP client via REST API)
– UDP clients (built-in in client to subscribe to server events)
3. Third-party dependencies
– cereal for serialization
– httplib for HTTP/REST
– nlohmann/json for JSON handling
4. Tools & scripts
– ecflow_fuse, load/shutdown/start shell scripts, suite generation
b. Relationships and interactions:
• CLI ↔ Server over TCP/SSL
• Qt GUI ↔ libViewer local socket → Server over TCP/SSL
• Python scripts ↔ Python API ↔ Server over TCP/SSL or REST
• External processes ↔ REST API over HTTP/BasicAuth
• Server publishes events via UDP; UDP clients subscribe
• Server core modules call persistence, scheduler, services internally
c. Architectural patterns and principles:
• Layered architecture:
• Protocol layer (TCP/SSL, HTTP, UDP)
• Application layer (command dispatch, domain logic in base/core/node)
• Persistence layer (checkpoint, file system)
• Service plugin layer (aviso, mirror, executor)
• Modular C++ libraries for clear separation of concerns
• Client abstraction: CLI, GUI, Python all build atop common client library
• Build & deployment via CMake, CI/CD via GitHub Actions and Bamboo containers
d. Key technologies/frameworks:
• C++17, CMake, Qt (for Viewer), cereal, httplib, nlohmann/json, Python3 bindings, OpenSSL (SSL/TCP)