Add resolvers in file loader#311
Conversation
|
The tests are currently failing because many of the configuration files includes a reference to The reason why the tests didn't fail before is because the behaviour has changed slightly in this PR. Now for |
|
The |
I think we should not need the file to exist or you end up with circular problems. To generate the tune response, you need a pyaml configuration. And if you already have a tune_response saved, you shouldn't need to generate it each time. |
Ah, I see what you mean. The configuration actually has two different type of files and they should be handled differently:
My question is then why for the tuning tools the first category is using the |
Excitation curves could also be annotated with "file:", but there is was never a need to do it because the .csv extension cannot be mistaken for a configuration file. I agree "file:" itself is a bad name. The idea was that "file:" represents the file-path itself and is not interpreted as a configuration file and the expansion is skipped. If we would put just the "response_matrix.json" path, then the file loader would interpret it as configuration, try to look for a "type: " entry and then fail to load because it doesn't have one. On this point I don't understand your implementation of the Generally I like the concept of the resolvers. The present implementation also gives a very obvious way to configure pyaml using a database: |
|
Okay. Then I understand. I had totally misunderstood the purpose of Then I should have a separate resolver for resolving subconfigurations. For those the file should be loaded and the content appended. At the moment I have mixed those two things into the same resolver. |
|
After some thinking, I have a new suggestion for the syntax of the resolvers:
|
This is OK for me. |
|
@TeresiaOlsson I think the proposed change is good. Please also check the config files in the examples (BESSY, SOLEIL, ESRF, etc.). They might require changes and currently the tests do not check if the changes broke the examples. |
Yes, in the PR #306 I added a simple loading test for those configuration files, so the test will fail if they are not up to date. |
|
I have added a separate resolver for path so the tests are working now. I also updated the examples and removed the |
This PR is for issue #310.
I have added the possibility to have different resolvers in the loader. Currently only two exists for
envandfile. The syntax for both of them is the same ${resolver:value}.The old syntax
file:has been removed and all test configuration files updated to instead use the new syntax.It is still supported to put a file without any syntax and it will be resolved as long as it has the file extension is in the
ACCEPTED_SUFFIXESlist.