Skip to content

Feature: dt4acc integration tests for the EPICS twin on the FODO lattice #520

Todo

Description

@gupichon-soleil

Feature: dt4acc integration tests for the EPICS twin on the FODO lattice

Description, motivation and use case
The dt4acc integration workflow only exercises the Tango twin today. It starts the dt4acc-soleil-twin image with tango-db-embedded, then runs tests/integration/test_dt4acc_twin_smoke.py against the FODO 1 GeV 6D lattice with the tango-pyaml and pyaml-cs-oa (Tango) backends. EPICS support in pyAML (through pyaml-cs-oa) has no end-to-end coverage against a running control system.

The same image now ships an EPICS twin (epics-embedded / epics-twin commands, no database to bootstrap), and pyaml-test-lattice 0.4.0 provides matching FODO fixtures:

  • dt4acc/fodo_1gev_6d_dt4acc_epics.json: generic EPICS catalog for the twin (32 quadrupoles, 32 sextupoles, 32 steerers)
  • pyaml/epics/pyaml-cs-oa/fodo_1gev_6d_pyaml-epics.yaml: pyAML configuration using pyaml_cs_oa.dynamic_catalog with backend: Epics (quadrupoles, sextupoles, CFM correctors, BPMs, RF plant, tune monitor)

Use case: catch regressions in pyAML or pyaml-cs-oa that break EPICS live access, the same way the Tango smoke tests do.

Proposed solution

  1. Twin startup: extend tests/integration/start_dt4acc_twin.sh with an EPICS mode (epics-embedded, --accelerator-setup-file, --lattice-file, --prefix). Readiness is the EPICS IOC ready: prefix=... log line instead of the Tango calculation heartbeat.
  2. Tests: add tests/integration/test_dt4acc_epics_twin_smoke.py, loading fodo_1gev_6d_pyaml-epics.yaml with the lattice override already used for Tango, and checking that:
    • the accelerator instantiates and live is available
    • QF_001 strength and the RF frequency read back finite and positive
    • every declared magnet and CFM strength reads back finite
    • BPM positions read back finite
  3. Workflow: add an epics job to .github/workflows/dt4acc-integration.yml, reusing the image pull and installing ophyd-async[ca, pva].
  4. Dependencies: raise pyaml-test-lattice to >=0.4.0 in the test extra, since the EPICS fixtures do not exist before.

Points to settle during implementation:

  • PV prefix: the twin defaults to DT4ACC_PREFIX, then the current user name, while the pyAML EPICS configuration declares no prefix. Either start the twin with an explicit empty prefix, or set a fixed prefix on both sides (twin --prefix and prefix of the pyaml_cs_oa control system).
  • Channel Access discovery on the runner: check whether EPICS_CA_ADDR_LIST=127.0.0.1 / EPICS_CA_AUTO_ADDR_LIST=NO (and the PVA equivalents) are needed.

Describe alternatives you've considered

  • Parametrize the existing test_dt4acc_twin_smoke.py by control system instead of adding a file. It avoids duplicating helpers, but the Tango tests read Tango device names directly (AN01-AR/EM-QP/QF.01/magnetic_strength), so most tests would need per-backend branches.
  • Run the Tango and EPICS twins in the same job. It saves one image pull, but doubles startup time and memory on a single runner, and a failure in one twin would hide the other result. Separate jobs are preferred.

Example

FODO_1GEV_6D_EPICS_CONFIG_KEY = "pyaml/epics/pyaml-cs-oa/fodo_1gev_6d_pyaml-epics.yaml"


def test_dt4acc_epics_twin_reads_all_declared_magnetic_strengths():
    accelerator = _build_accelerator(FODO_1GEV_6D_EPICS_CONFIG_KEY)
    magnets = accelerator.live.magnets.get()

    for magnet in magnets:
        assert np.isfinite(float(magnet.strength.get()))
bash tests/integration/start_dt4acc_twin.sh --mode epics \
  --accelerator-setup-file "$ACCEL_SETUP_FILE" \
  --lattice-file "$LATTICE_FILE" \
  --prefix "" \
  --sif dt4acc-soleil-twin.sif --detach

Additional context

  • The tests are marked @pytest.mark.integration and skipped unless PYAML_DT4ACC_INTEGRATION=1, like the Tango ones.
  • Locally, the Tango twin started all 83 servers at once and saturated its embedded database on an 8 GB WSL machine. DT4ACC_TANGO_START_BATCH_SIZE=10 avoided it. The EPICS twin has no database, so it should not hit this.

Checklist

  • I've assigned this issue to a project
  • I've @-mentioned relevant people

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions