You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow a single FastCS server to have multiple top level Controllers with different prefixes #120
We need to decide how the PV prefixes for each controller would be configured in the transport in the config file. The obvious way is a list of prefixes with indexes that match the list of Controllers, but that is pretty horrible. Maybe we could change to a dictionary of name -> Controller? I am not sure what we would actually use the name for other than correlating config, but it could be useful.
Then each transport would have a method called serialized_controllers that would have to match the top level controllers to make sure there are no missing ones
Alternatively you put a set of transport specific params under the controllers:
Another possible option (that I am also not sure I like). We have multiple config files, one per controller with the transports we want it to be served over. These are all loaded and combined programmatically so that there is no concern of lists of controllers and lists of pv prefixes being in the wrong order. There would still only be one instance of each transport.
This would mean the simple case of one Controller still looks nice and we don't have lists of controllers and pv_prefixes of length one. I think it would also the GUI config a bit easier.
Is there anything shared between all transports? I'd be loath to have to repeat N lines of the same variables in each file to save typing 1 unique string...
Do anchors and aliases work across documents in one file?
That would be neat, but I don't think you can't use anchors and aliases across documents in one file.
If you did have GUI for both transports, they would have to be different anyway because otherwise they would clash. I imagine it would look something like this:
Controller taking transport_overrides would also mean ControllerAPI taking transport_overrides and then Transport.connect checking for fields its own key. I think this would be OK... but in the schema transport_overrides would have to allow anything, so it would be easy to make a typo and potentially it would silently fail.
In terms of the code, gql, rest and tango could all easily iterate over lists of controller apis. They don't have an equivalent of pv prefix that would need to be different. For epicsca and epicspva, the simplest thing would be to zip lists of ioc options, gui options and apis here and here. Having to search through the controller apis to find overrides would add complexity.
This seems like a good compromise. It will be less clear for controls engineers, but if we just explain that this field on the controller will get turned into the PV prefix I think that's fine. It is the same as sub controller path getting turned into the PV name. Maybe this is just the root controller having a path rather than it being empty.
YAML structurally enforces id uniqueness — no manual check needed.
Maps 1:1 to the runtime shell context (controllers: dict[str, Controller]).
Removes the id: boilerplate.
Insertion order is preserved (ruamel safe loader returns ordered dicts).
Other outcomes from today's design pass that aren't in writing yet:
launch() takes a list of Controller classes; YAML entries pick the class via a type: field (defaults to class __name__); single-class registrations can elide type:.
The id lives on the Controller instance (set after construction by the launcher) and becomes the first segment of every transport path. EPICS-style PV prefixes via path[0] verbatim, sub-controller path segments still go through snake_to_pascal.
Each transport validates id against its own naming rules at connect() time and fails fast on illegal characters — no silent name mangling. Acknowledged limitation: mixing transports with incompatible naming rules forces a lowest-common-denominator id.
EpicsIOCOptions.pv_prefix (and the EpicsIOCOptions dataclass) gets removed entirely.
One softioc per process, N PVI roots — EpicsCAIOC (and PVA equivalent) takes the full list of ControllerAPIs and iterates.
Single Controller still works as a list-of-one. No backwards-compat path for the old singular controller: YAML form — clean break, single schema.
Shell context: controllers: dict[id, Controller], with a Controller.api back-pointer so controllers["BLxxI-EA-ECAT-01"].api.path works without a parallel controller_apis dict.
Full PRD with user stories, implementation decisions, and testing plan: #351
Shout if any of this looks wrong before I start writing code.
@coretl do you mean that if we change the path in a given subcontroller, that needs to then be promoted to a button in index.bob. (if we use the default path then its part of the pre-existing bob file hierarchy). Am I understanding you?
Activity
GDYendell commentedon Jan 8, 2026
@coretl do we want to do this in the CATio sprint?
GDYendell commentedon Jan 14, 2026
We need to decide how the PV prefixes for each controller would be configured in the transport in the config file. The obvious way is a list of prefixes with indexes that match the list of Controllers, but that is pretty horrible. Maybe we could change to a dictionary of name -> Controller? I am not sure what we would actually use the name for other than correlating config, but it could be useful.
coretl commentedon Jan 16, 2026
Can we do something with anchors and aliases?
Then each transport would have a method called
serialized_controllersthat would have to match the top level controllers to make sure there are no missing onesAlternatively you put a set of transport specific params under the controllers:
Then you have to make sure that you have transports that can handle the given transport parameters
GDYendell commentedon Jan 19, 2026
I don't love either of these 😅
Another possible option (that I am also not sure I like). We have multiple config files, one per controller with the transports we want it to be served over. These are all loaded and combined programmatically so that there is no concern of lists of controllers and lists of pv prefixes being in the wrong order. There would still only be one instance of each transport.
This would mean the simple case of one Controller still looks nice and we don't have lists of
controllersandpv_prefixesof length one. I think it would also the GUI config a bit easier.coretl commentedon Jan 19, 2026
Is there anything shared between all transports? I'd be loath to have to repeat N lines of the same variables in each file to save typing 1 unique string...
Do anchors and aliases work across documents in one file?
E.g.
GDYendell commentedon Jan 21, 2026
That would be neat, but I don't think you can't use anchors and aliases across documents in one file.
If you did have GUI for both transports, they would have to be different anyway because otherwise they would clash. I imagine it would look something like this:
There is a complication that for graphql the config would have to be match, whereas you want the config to be different for CA...
coretl commentedon Jan 21, 2026
Hmm, how about merging all the files into a list then, and allowing per-controller overrides?
GDYendell commentedon Jan 27, 2026
Controller taking transport_overrides would also mean ControllerAPI taking transport_overrides and then Transport.connect checking for fields its own key. I think this would be OK... but in the schema transport_overrides would have to allow anything, so it would be easy to make a typo and potentially it would silently fail.
In terms of the code, gql, rest and tango could all easily iterate over lists of controller apis. They don't have an equivalent of pv prefix that would need to be different. For epicsca and epicspva, the simplest thing would be to zip lists of ioc options, gui options and apis here and here. Having to search through the controller apis to find overrides would add complexity.
coretl commentedon Jan 28, 2026
Maybe we could go back to what we have at the moment, but give every controller an ID that could be used as the PV prefix or the GQL reference?
GDYendell commentedon Feb 2, 2026
This seems like a good compromise. It will be less clear for controls engineers, but if we just explain that this field on the controller will get turned into the PV prefix I think that's fine. It is the same as sub controller path getting turned into the PV name. Maybe this is just the root controller having a path rather than it being empty.
gilesknap commentedon May 5, 2026
What I think I'm implementing (@coretl to verify this is what you want!)
fastcs.yamlinstead ofcontroller.yamland may container multiple controller definitionsfastcs.yamlgilesknap commentedon May 5, 2026
Tom and I have agreed that it should look like this
gilesknap commentedon May 5, 2026
@coretl
A revision while planning: switching from list-with-id-field to dict-keyed-by-id for the controllers: block:
Reasoning:
gilesknap commentedon May 5, 2026
Small revision while planning: switching from list-with-
id-field to dict-keyed-by-id for thecontrollers:block:instead of:
Reasoning:
controllers: dict[str, Controller]).id:boilerplate.Other outcomes from today's design pass that aren't in writing yet:
launch()takes a list ofControllerclasses; YAML entries pick the class via atype:field (defaults to class__name__); single-class registrations can elidetype:.idlives on theControllerinstance (set after construction by the launcher) and becomes the first segment of every transport path. EPICS-style PV prefixes viapath[0]verbatim, sub-controller path segments still go throughsnake_to_pascal.idagainst its own naming rules atconnect()time and fails fast on illegal characters — no silent name mangling. Acknowledged limitation: mixing transports with incompatible naming rules forces a lowest-common-denominator id.EpicsIOCOptions.pv_prefix(and theEpicsIOCOptionsdataclass) gets removed entirely.EpicsCAIOC(and PVA equivalent) takes the full list ofControllerAPIs and iterates.controller:YAML form — clean break, single schema.controllers: dict[id, Controller], with aController.apiback-pointer socontrollers["BLxxI-EA-ECAT-01"].api.pathworks without a parallelcontroller_apisdict.Full PRD with user stories, implementation decisions, and testing plan: #351
Shout if any of this looks wrong before I start writing code.
coretl commentedon May 5, 2026
I agree with N PVI roots, but we still need to make
index.bobwith buttons forBLxxI-EA-ECAT-01andBLxxI-EA-ERIO-01in the same way as a C++ IOC.gilesknap commentedon May 13, 2026
@coretl do you mean that if we change the path in a given subcontroller, that needs to then be promoted to a button in index.bob. (if we use the default path then its part of the pre-existing bob file hierarchy). Am I understanding you?
coretl commentedon May 13, 2026
Yes, the path heirarchy should be the button heirarchy on the screens and the PVI heirarchy.
E.g. for ethercat, the controller heirarchy would be something like:
which would make a PVI hierarchy:
which would make a screen hierarchy: