Skip to content

Make the elio role more flexible - automatically get num terminals, num channels per terminal, and allow for customizing specific record fields#249

Open
Jakub Wlodek (jwlodek) wants to merge 4 commits into
NSLS2:mainfrom
jwlodek:make-elio-more-flexible
Open

Make the elio role more flexible - automatically get num terminals, num channels per terminal, and allow for customizing specific record fields#249
Jakub Wlodek (jwlodek) wants to merge 4 commits into
NSLS2:mainfrom
jwlodek:make-elio-more-flexible

Conversation

@jwlodek

@jwlodek Jakub Wlodek (jwlodek) commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Allows for specifying custom fields for specific channel's records.

Note: I slightly changed the schema, so any already deployed configurations in ioc_host_vars will need to be updated.

…um channels per terminal, and allow for customizing specific record fields

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the elio device role configuration model to make EK9000 terminal setup more data-driven and to support channel-specific macro overrides when loading per-terminal records.

Changes:

  • Replace the old NUM_TERMS environment variable with deriving terminal count from the terminals list.
  • Restructure terminals entries from positional lists to structured mappings (POS, MODEL, optional CHAN_SPECIFIC_CONFIG).
  • Add optional channel-specific macro injection when loading templates, and update the role example accordingly.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
roles/device_roles/elio/templates/base.cmd.j2 Derives terminal count and adds optional per-channel template loading with channel-specific macros.
roles/device_roles/elio/schema.yml Updates schema to require structured terminals entries and adds optional CHAN_SPECIFIC_CONFIG.
roles/device_roles/elio/example.yml Updates example config format and demonstrates channel-specific configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 5 to +6
# Configure the low level communication port
ek9000Configure("${EK9K}", "${HOST}", 502, ${NUM_TERMS})
ek9000Configure("${EK9K}", "${HOST}", 502, {{ ioc.terminals | length }})

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dyon Buitenkamp (@dbuitenka) I am not sure if copilot is right to be concerned here. Would there ever be a case that the POS fields don't start at 1 and are contiguous from there?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jakub Wlodek (@jwlodek) The POS field should always start at 1 and be contiguous. There should never be a need for anything else.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, could we perhaps remove it and just use the index in the terminals list as the position?

Comment thread roles/device_roles/elio/templates/base.cmd.j2
Comment thread roles/device_roles/elio/templates/base.cmd.j2
Comment thread roles/device_roles/elio/schema.yml Outdated
Comment thread roles/device_roles/elio/schema.yml Outdated
Comment thread roles/device_roles/elio/example.yml Outdated
Jakub Wlodek (jwlodek) and others added 2 commits June 10, 2026 12:58
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
{% for key, value in chan_config.items() %}
{% set _ = chan_macros.append(key ~ "=" ~ value) %}
{% endfor %}
dbLoadTemplate("{{ deploy_ioc_template_root_path }}/db/$(MODEL).template","DEVICE=$(EK9K), Sys=$(SYS), Dev=$(Dev), POS=$(POS), CHAN={{ chan }}{% if chan_macros %}, {{ chan_macros | join(', ') }}{% endif %}")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should be dbLoadRecords instead of dbLoadTemplate as it is expecting a substitution file otherwise.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The testing of this code looks to be successful now.

@jwlodek

Copy link
Copy Markdown
Collaborator Author

hxu-bnl do you mind reviewing before I merge this?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants