How helgestein/helao-pub works
Project Type and Purpose
• HELAO is a distributed, hierarchical laboratory automation and orchestration framework built atop FastAPI.
• It orchestrates “experiments” defined as sequences of “actions,” each wrapping lower-level hardware drivers or analysis steps.
File Structure
• Top-Level Python Scripts:
– helao.py / launcher.py / main.py: CLI entry points for validating config and launching server groups.
– cli.py / Run-File.ps1 / RunPython.ps1: Helpers for local runs or interactive use.
• ‘orchestrators/’: Orchestrator implementations (demo orchestration logic, generic orchestrator class).
• ‘action/’: High-level wrappers exposing device or analysis functionality via REST.
• ‘driver/’: Low-level device drivers (real or simulation) for each hardware component.
• ‘server/’: FastAPI server scripts that wrap drivers to expose HTTP APIs.
• ‘config/’: JSON and Python files defining server groups, device parameters, and world configurations.
• ‘visualizer/’, ‘notebooks/’: Client-side tools for inspecting data or demoing Kafka integration.
• ‘celery_conf.py’: Async task configuration for long-running operations (e.g., machine-learning).
Extract Additional Insights from README
• Hierarchical Layers: Orchestrator → Actions → Drivers.
• Communication: All layers expose Python class methods through FastAPI.
• Experiment Definition: A JSON/YAML “sequence of events” (SOE) passed into the orchestrator.
• Devices: A catalog of motion, electrochemistry, spectroscopy, and analysis “devices,” each with its own driver and server.
a. Client Layer
– CLI / helao.py / notebooks / visualizer
– Submits experiments (SOEs) via REST to the Orchestrator
b. Orchestration Layer
– orchestrator.py + demo_orch.py
– Receives experiment definitions, manages SOE, and dispatches Actions
c. Action Layer
– action/*.py modules
– Expose high-level routines (e.g., measure, pump, analyze ML) via FastAPI
d. Driver Layer
– driver/*_driver.py modules
– Interface to real hardware or simulation code
e. Hardware / Simulation
– Physical devices or their simulate counterparts (galil_simulate, gamry_simulate, etc.)
f. Configuration & Persistence
– config/*.py, config.json: define which servers to launch in a “world”
– Experiment metadata, HDF5 output files stored on disk
g. Supporting Infrastructure
– celery_conf.py for asynchronous tasks
– Kafka listener/sender in notebooks (optional messaging layer)
Relationships & Data Flows
• Client → Orchestrator:
– POST /experiments with SOE JSON → orchestrator REST endpoint
• Orchestrator → Action:
– For each event, HTTP call to action service (action host:port)
• Action → Driver:
– HTTP call to driver server (driver host:port)
• Driver → Hardware/Simulation:
– Direct API (TCP/IP, serial, .NET DLL) or call simulate module
• Data Persistence:
– Drivers or actions write measurement data to HDF5 or local files
• Async Tasks:
– Long-running actions may enqueue jobs via Celery
Architectural Patterns & Design Principles
• Hierarchical layering for clear separation of concerns
• Microservice-style deployment: each action/driver runs as a separate FastAPI server
• Configuration-driven deployment: define server groups in config/world.py
• RESTful APIs for inter-service communication
• Experiment-level metadata propagation down to all layers