Skip to content

Allow cats_config.yml and cats_config.yaml#146

Merged
andreww merged 3 commits intoGreenScheduler:mainfrom
andreww:configname
Jun 24, 2025
Merged

Allow cats_config.yml and cats_config.yaml#146
andreww merged 3 commits intoGreenScheduler:mainfrom
andreww:configname

Conversation

@andreww
Copy link
Collaborator

@andreww andreww commented Jun 6, 2025

This change allows us to read configuration data from local files cats_config.yml, cats_config.yaml or config.yml. The first file found (in that order) is read and any others are ignored.

I've also updated the tests to check that this works which involved fun with fixtures. Having thought about it a bit more this could probably be cleaned up with a parameterisation but I'm not sure about extracting the parameter for the test in the fixture ... something for another day.

Still need to update the documentation to match and as well as cleanup in the tests, I'm pretty sure that config_from_file function could be simplified.

Fixes #145

@codecov
Copy link

codecov bot commented Jun 6, 2025

Codecov Report

❌ Patch coverage is 89.47368% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.72%. Comparing base (f43833e) to head (267d343).
⚠️ Report is 26 commits behind head on main.

Files with missing lines Patch % Lines
cats/configure.py 73.33% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #146      +/-   ##
==========================================
+ Coverage   81.80%   82.72%   +0.91%     
==========================================
  Files          14       14              
  Lines         687      712      +25     
==========================================
+ Hits          562      589      +27     
+ Misses        125      123       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

andreww added 2 commits June 24, 2025 10:23
This change allows us to read configuration data from local files
cats_config.yml, cats_config.yaml or config.yml. The first file
found (in that order) is read and any others are ignored.

I've also updated the tests to check that this works which involved
fun with fixtures. Having thought about it a bit more this could
probably be cleaned up with a parameterisation but I'm not sure
about extracting the parameter for the test in the fixture ...
something for another day.
We now log (at warning level) the fact that config.yml (and config.yaml,
which is now accepted) are deprecated in favour of cats_config.yml/yaml.

Add a new test to check things for for config.yaml.

To do this in a sensible way, I removed the early returns from within
config_from_file() which resulted in us skipping some existing
logging messages. We now only return at the end of the function and
logging is performed as appeared to be intended in the code. We could
(I think) simplify the logic further by collapsing all the possible
paths into a single loop so we just accept the first. But that's for
later refactoring.
@andreww andreww marked this pull request as ready for review June 24, 2025 09:24
@andreww
Copy link
Collaborator Author

andreww commented Jun 24, 2025

@sadielbartholomew, @abhidg - thanks for the comments. I think this is now ready to review and merge.

@sadielbartholomew
Copy link
Member

sadielbartholomew commented Jun 24, 2025

Otherwise happy for a merge @andreww but I have one question as raised above.

@abhidg
Copy link
Contributor

abhidg commented Jun 24, 2025

@andreww looks good to me!

Copy link
Member

@sadielbartholomew sadielbartholomew left a comment

Choose a reason for hiding this comment

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

I am happy and so is Abhishek so please merge when ready.

@andreww andreww merged commit ff3c2ab into GreenScheduler:main Jun 24, 2025
10 checks passed
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.

Potential filename clashes with config.yml

3 participants