Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add repeats to entity declarations in ioc.yaml #258

Open
gilesknap opened this issue Nov 13, 2024 · 3 comments
Open

Add repeats to entity declarations in ioc.yaml #258

gilesknap opened this issue Nov 13, 2024 · 3 comments

Comments

@gilesknap
Copy link
Member

gilesknap commented Nov 13, 2024

This is to allow repeating elements in ioc.yaml.

(details to be reviewd)

Add a new field repeat of type list to entity that allows you to iterate over a list and instantiate a number of the same entity. The context for each step will include the variables val and idx which can be used to differentiate the individual entities.

examples:

  - type: ADCore.NDPvaPlugin
    repeat: {{ range(5) | list }} 
    NDARRAY_PORT: DET.CAM
    P: BL47P-EA-DET-01
    PORT: DET.PVA{{ repeate.val }}
    R: ":TX{{ repeat.val }}:"
    PVNAME: BL47P-EA-DET-01:TX{ repeat.val }}:PVA
  - type: epics.dbpf
    repeat: [ hello, world ]
    pv: BL47P-EA-DET-01:WORD{{ repeat.num }}
    value: "{{ repeat.val }}"
@gilesknap
Copy link
Member Author

gilesknap commented Nov 13, 2024

And combining this with #257 we could do

ioc.yaml

  - type: epics.dbpf
    repeat: {{ env.words | list }}
    pv: {{ env.prefix }}:WORD{{ repeat.num }}
    value: "{{ repeat.val }}"

env.yaml

words: [ now, is, the, time, for, all, good ]
prefix: BL47P-EA-DET-01

@coretl
Copy link
Contributor

coretl commented Nov 14, 2024

I like the concept, but rather than a reserved argument I wonder if it would be clearer to make a nested object:

  - type: ibek.repeat
    variable: index
    values: {{ range(5) | list }}
    entity:
      type: ADCore.NDPvaPlugin
      NDARRAY_PORT: DET.CAM
      P: BL47P-EA-DET-01
      PORT: DET.PVA{{ index }}
      R: ":TX{{ index }}:"
      PVNAME: BL47P-EA-DET-01:TX{{ index }}:PVA

@gilesknap
Copy link
Member Author

As agreed in G13 - we will go with 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

No branches or pull requests

2 participants