Skip to content

About

MLDP ingestion driver for EPICS and beyond

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

69 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MLDP PVXS Driver

logo

This project provides a generic driver architecture for ingesting real-time or historical samples into the MLDP ingestion API (see MLDP). It separates source readers from batching/transport so multiple data-source implementations can publish normalized payloads to MLDP over gRPC.

DOI Code - 10.11578/dc.20260305.3

Configuration Summary

The driver builds one effective configuration by accumulating one or more -c/--config inputs. Each -c value must be either:

  • a path to an existing YAML file, or
  • a dotted PATH=VALUE assignment, which is converted to YAML and merged in

All -c inputs are merged in the order provided.

The effective configuration has five top-level sections:

Key Required Purpose
name no Controller instance label (metrics scope)
writer yes (≥1) Output sinks (mldp, hdf5, hdf5-merge)
reader yes (≥1) Input sources (epics-pvxs, epics-base, epics-archiver); EPICS readers take PVs inline (pvs) and/or from text files (pvs-files)
routing no Reader-to-writer routing and optional source filters
metrics no Prometheus exporter settings

Use these docs for full details:

Architecture Summary

The architecture is reader → bus → controller → writer:

  1. Readers collect live or historical EPICS data.
  2. Readers push normalized batches onto IDataBus.
  3. Controller partitions and routes batches.
  4. Writers deliver to MLDP gRPC or HDF5 storage.

Readers can be long-running (e.g., live PV subscriptions that stream indefinitely) or one-shot (e.g., archiver queries that finish after retrieving a fixed dataset). When a one-shot reader completes, it signals the controller and is automatically removed. Once all readers have finished and no readers remain active, the CLI exits automatically.

For detailed diagrams and threading/data-flow internals see Architecture Overview.

Command-line interface

The driver is configured from one or more -c/--config inputs (see above) and is started from the command line.

Usage

mldp_pvxs_driver [--help] [--version] [--config SOURCE]... [--log-level LEVEL] [--metrics-output FILE] [--metrics-interval SECONDS] [--print-config-startup] [--dry-run]

Options

  • -h, --help
    • Show the built-in help and exit.
  • -v, --version
    • Print the version and exit.
  • -c, --config SOURCE
    • Configuration source.
    • If SOURCE is an existing file, it is loaded as YAML.
    • Otherwise SOURCE must be a dotted assignment like metrics.endpoint=0.0.0.0:9464.
    • May be repeated; all values are merged in order into one effective configuration.
    • Default when omitted: config.yaml
  • -l, --log-level LEVEL
    • Logging verbosity.
    • Accepted values: trace, debug, info, warn, error, critical, off
    • Default: info
    • Notes: value is case-insensitive; warning is accepted as warn, err as error, and fatal as critical.
  • -m, --metrics-output FILE
    • Path to output file for periodic metrics dumps (JSON Lines format).
    • Default: metrics.jsonl
  • --metrics-interval SECONDS
    • Interval in seconds for periodic metrics dumps.
    • Default: 5
  • --print-config-startup (alias: --print-config)
    • Print a compact, user-friendly summary of the effective startup configuration.
    • Default: disabled
  • --dry-run
    • Load and validate config, then exit without starting driver/readers.
    • Default: disabled

Examples

# Run with an explicit config file
./mldp_pvxs_driver -c ./config.yaml

# Enable debug logging
./mldp_pvxs_driver -c ./config.yaml --log-level debug

# Print effective config at startup (compact format)
./mldp_pvxs_driver -c ./config.yaml --print-config-startup

# Validate config and exit without starting runtime components
./mldp_pvxs_driver -c ./config.yaml --dry-run

# Validate + print effective config summary, then exit
./mldp_pvxs_driver -c ./config.yaml --print-config --dry-run

# Merge a config file with dotted assignments
./mldp_pvxs_driver \
  -c ./config.yaml \
  -c metrics.endpoint=0.0.0.0:9464 \
  -c reader.hdf5-bsas-gen1[0].file-path=/tmp/bsas.h5 \
  --dry-run

# Show help/version
./mldp_pvxs_driver --help
./mldp_pvxs_driver --version

For periodic metrics dumps and manual triggers (Ctrl+P, Ctrl+D, SIGUSR1/SIGQUIT), see the metrics export guide.

Configuration Management

Instead of writing YAML by hand, use the built-in configuration utilities (run without -c):

Interactive Configuration Wizard

# Generate a new config.yaml interactively
mldp_pvxs_driver config wizard

# Or seed from an existing config and modify it
mldp_pvxs_driver config wizard --from old-config.yaml --output new-config.yaml

Configuration Templates

# Print minimal template (MLDP writer + PVXS reader)
mldp_pvxs_driver config template --minimal

# Print full template (both writers, all readers)
mldp_pvxs_driver config template --full

Configuration Validation

# Validate a YAML file and report field-level errors/warnings
mldp_pvxs_driver config validate config.yaml

Configuration Inspection

# Show all writers, readers, routing rules, and metrics settings
mldp_pvxs_driver config list config.yaml

Configuration Editing

# Add a new reader, writer, or routing entry interactively (KIND is optional — prompted when omitted)
mldp_pvxs_driver config add config.yaml
mldp_pvxs_driver config add writer config.yaml    # skip kind prompt, go straight to writer type
mldp_pvxs_driver config add reader config.yaml
mldp_pvxs_driver config add routing config.yaml

# Remove a named writer, reader, or routing entry
mldp_pvxs_driver config remove writer config.yaml --name mldp_main
mldp_pvxs_driver config remove reader config.yaml --name pvxs_live

All config subcommands support --help for per-command options.

Architecture

🚀 New to the driver? Start with the User Guide — annotated YAML examples covering every reader, writer, routing, and source-filter scenario. No C++ knowledge required.

Readers collect data from configurable sources, push normalized batches onto a shared bus, and the controller routes them to one or more writers — each writer delivering to a different storage or transport backend.

Documentation

For developer information and contribution guidelines see CONTRIBUTING.md.

External Software

  • EPICS Base (default: R7.0.8.1) provides the core EPICS runtime and libCom.
  • PVXS (default: 1.4.1) provides the PVAccess client used to subscribe to EPICS PVs.
  • gRPC (system package; version per toolchain) provides the RPC transport to the MLDP ingestion service.
  • Protocol Buffers (system package; version per toolchain) generates and serializes MLDP protobuf payloads.
  • dp-grpc proto definitions supply the MLDP ingestion API .proto files used at build time.
  • OpenSSL (system library; version per OS/toolchain) provides TLS for gRPC credentials.
  • spdlog v1.16.0 provides structured logging.
  • prometheus-cpp v1.3.0 provides the metrics registry and HTTP exporter.
  • argparse v3.2 provides CLI argument parsing.
  • date v3.0.1 provides IANA timezone and daylight-saving conversion for query timestamp formatting.
  • rapidyaml 0.10.0 (vendored in ext/rapidyaml) parses the YAML configuration.
  • BS::thread_pool 5.0.0 (vendored in ext/BS_thread_pool) provides the controller worker thread pool.
  • libevent (system library; required when statically linking PVXS) supplies PVXS' event loop dependencies in static builds.
  • CMake 3.15+ configures and builds the project.

Releases

Tagged releases (vX.Y.Z) publish:

  • A container image (recommended way to run).
  • A standalone executable artifact (currently named mldp_pvxs_driver-rockylinux-9.3-epics-R7.0.8.1).
  • An AppImage for easier distribution (currently named mldp_pvxs_driver-rockylinux-9.3-epics-R7.0.8.1-pvxs-1.4.1-x86_64.AppImage).

Builder image + build cache (for developers)

The current CI/CD publishes and refreshes four related builder/dev refs in GHCR:

  • ghcr.io/slaclab/mldp-pvxs-driver/build:epics-7.0.8.1-pvxs-1.4.1
  • ghcr.io/slaclab/mldp-pvxs-driver/dev:rockylinux-9.3-builder-r7.0.8.1-1.4.1
  • ghcr.io/slaclab/mldp-pvxs-driver/rockylinux-9.3-builder-r7.0.8.1-1.4.1:buildcache
    • Variant-specific builder image tag used to keep the registry cache warm.
  • ghcr.io/slaclab/mldp-pvxs-driver/rockylinux-9.3-builder-r7.0.8.1-1.4.1:buildkitcache
    • Registry-backed BuildKit cache export used by both CI workflows.

For local docker buildx builds, use both the shared builder image and the variant-specific BuildKit cache as cache sources, which matches the current CI setup:

docker login ghcr.io

docker buildx build \
  -f .devcontainer/Dockerfile \
  --build-arg BASE_OS_IMAGE=rockylinux/rockylinux:9.3 \
  --build-arg EPICS_VERSION=R7.0.8.1 \
  --build-arg PVXS_VERSION=1.4.1 \
  --cache-from type=registry,ref=ghcr.io/slaclab/mldp-pvxs-driver/build:epics-7.0.8.1-pvxs-1.4.1 \
  --cache-from type=registry,ref=ghcr.io/slaclab/mldp-pvxs-driver/rockylinux-9.3-builder-r7.0.8.1-1.4.1:buildkitcache \
  -t mldp-pvxs-driver-dev:latest \
  --load \
  .

Notes:

  • The shared build:epics-...-pvxs-... tag is the stable cross-branch builder reference.
  • The dev:<variant> tag tracks the latest dev image for that OS/EPICS/PVXS matrix entry.
  • The :buildkitcache ref is not a runnable image; it is a registry cache export for BuildKit.
  • The :<variant>:buildcache tag is a pushed builder image that helps keep the cache hot on main.

EPICS/PVXS locations

In the builder/dev container image:

  • EPICS Base source is cloned into /opt/epics and installed into /opt/local.
  • PVXS source is cloned into /opt/pvxs and installed into /opt/local.
  • The EPICS host architecture is recorded in /etc/epics_host_arch (e.g. linux-x86_64).

In the runtime/release container image:

  • /opt/local is copied from the builder stage and contains EPICS Base + PVXS headers and libraries.
  • EPICS_BASE=/opt/local and PVXS_BASE=/opt/local are set in the runtime image.

Where EPICS/PVXS versions are set

Standalone executable runtime dependencies

The standalone executable artifact is dynamically linked (not a fully static binary). This means it requires shared libraries to be present on the target host at runtime.

At a minimum, the binary depends on:

  • gRPC + Protobuf runtime libraries (and their transitive deps like Abseil, c-ares, re2)
  • OpenSSL (libssl, libcrypto)
  • EPICS Base runtime (libCom)
  • PVXS runtime (libpvxs)

In the release build environment, EPICS Base + PVXS are installed under /opt/local, and the binary is built with a runtime search path pointing there. If you download and run the standalone artifact on a different host, you must either:

  • install compatible EPICS Base + PVXS and ensure they are discoverable by the dynamic loader (e.g., via LD_LIBRARY_PATH or a matching install prefix), and install the required gRPC/Protobuf/OpenSSL runtime packages, or
  • run via the published Docker image, which includes the correct runtime environment.

Legal

Copyright Notice

COPYRIGHT © SLAC National Accelerator Laboratory. All rights reserved. This work is supported [in part] by the U.S. Department of Energy, Office of Basic Energy Sciences under contract DE-AC02-76SF00515.

Usage Restrictions

Neither the name of the Leland Stanford Junior University, SLAC National Accelerator Laboratory, U.S. Department of Energy nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

About

MLDP ingestion driver for EPICS and beyond

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages