Replies: 3 comments 1 reply
-
devices:
- bpms.yaml
- diag_tools.yaml
- tuning_tools.yaml
- magnets.yamlThe above has to be supported and it should be easy to fixed during list expansion: # Recursively expand a list
def expand_list(self, l: list):
idx = 0
while idx < len(l):
value = l[idx]
if hasToLoad(value):
obj = load(value, self.files_stack)
if isinstance(obj,list):
l[idx:idx+1] = obj
idx += len(obj)
else:
l[idx] = obj
idx += 1
else:
self.expand(value)
idx += 1 |
Beta Was this translation helpful? Give feedback.
-
|
A key aspect to include is that the configuration must be able to handle third-party applications or devices or all the labs who are interested in integrating their existing tools and development with pyAML won't be able to do it and we will lose them as contributors and users. To achieve that I think some things have to be refactored and be made more flexible. These are the things I have found so far which cause problems:
My suggestion is that we take inspiration from HAPPI and generalise the configuration by changing it to specify which class to initialise and which attributes to use to initialise an object of that class. Since that is Python generic it makes it possible to write a generic factory to build any class and optionally validate the input data in case a |
Beta Was this translation helpful? Give feedback.
-
|
I also suggest that we give up on the idea of directly using the yaml file and start to only consider it as one option as a backend for a config database (other options can be json, mongodb etc depending on what labs want to add support for in the future). This is meant to be hidden from the users and never be directly modified, but instead only be interacted with through a config client with some user-friendly API. Then there is no need of being able to do something like: because that is something that would be handled internally by the config client. In The config client can then be responsible for handling dynamic changes, the yellow pages and generating a configuration from scratch and in that way provide a single, clear entry point for the configuration for both users and different parts of the the code that need access to the configuration data. It can also provide the factory to generate objects based on the current configuration data if that turns out to be a good idea as is done in HAPPI. I envision two ways to use this type of config client.
I also envision that perhaps option 1 could allow for having several accelerators defined inside the same database? If I have understood correctly, that's how the TANGO database works? At least at MAX IV it was the same database for all of their accelerators. Option 2 could then be the way to use scopes to only get the configuration for a specific accelerator in the database. For example, you can use the config client directly if you want to see the config for transfer line, booster, storage ring etc all together but if you use the client through the I think that would be nice because it would allow you to only have to maintain one configuration database for all your machines if you want. And maybe this could also make it easier to integrate with the TANGO database and use the introspection capabilities of TANGO to automatically fill in some fields in the configuration database for the labs which like that idea. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Overview
The goal of this discussion is to consolidate the ongoing improvements around configuration and API design in order to maintain overall consistency. It also aims to validate key API choices early, in particular to avoid redundancy or overlap between existing concepts such as YellowPages and ElementHolder, and to ensure a coherent direction across all related developments.
This discussion focuses on improving both the configuration model and the API usability in PyAML. The goal is to simplify workflows, increase flexibility, and enable more dynamic behavior while keeping the system consistent and maintainable.
Configuration Model
Backend Linking
The configuration should rely on a key/value manager to link objects to the backend:
This approach is aligned with the catalog work introduced in PR #192 .
Workflow
The expected workflow is:
Load a static configuration
Optionally modify it dynamically:
This implies that configurations should not be considered immutable after loading.
An open question is whether dedicated tools should be introduced to help build configurations. If so, several aspects need to be clarified:
Configuration Composition and Modification
Current State
Configuration composition is already supported through multiple YAML files. However:
Proposed Improvements
1. Direct Multi-file Loading
Current state:
Configuration composition is already possible by splitting the configuration into multiple YAML files and referencing them from a main file. However, this approach has several limitations:
In particular, it is currently not possible to write something like:
or:
It is also not possible to express composition directly within YAML itself. For example, the following is not supported:
Proposed improvement:
Allow the PyAML builder to accept multiple configuration fragments directly, without requiring a pre-built main file.
This would:
2. Dynamic Post-load Modification
After loading a configuration, it should be possible to:
3. Validation and Mutability Support
To support safe dynamic updates:
This approach has already been explored in PR #214.
Benefits:
API: Access to Tools and Objects
Improving the API for accessing high-level objects is already being discussed in:
The objective is to provide:
High-Level Object Management
Introducing a manager for high-level objects could significantly improve consistency across:
Expected Benefits
Relation with Yellow Pages
The Yellow Pages concept could be extended to support this:
Beta Was this translation helpful? Give feedback.
All reactions