-
Notifications
You must be signed in to change notification settings - Fork 94
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
Global config hierarchy #3802
Global config hierarchy #3802
Conversation
I'm not sure how best to test the global config hierarchy |
|
cylc/flow/cfgspec/globalcfg.py
Outdated
if os.access(fname, os.F_OK | os.R_OK): | ||
self.loadcfg(fname, upgrader.USER_CONFIG) | ||
else: | ||
LOG.warning( | ||
f'No global.cylc file at CYLC_CONF_PATH: {conf_path_str}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this useful? I noticed there was a previous commit to raise an error if the path doesn't exist, but that commit was reverted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this environment variable can get copied to remote platforms (which aren't on the same filesystem) this warning is useful some of the time, and misleading some of the time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, removing it on the basis that being misleading some of the time is worse than not being helpful some of the time
6a64ada
to
06c16c2
Compare
I've found it messy trying to unit test the exact config dir hierarchy, but at least there is a doctest for the version number hierarchy: cylc-flow/cylc/flow/cfgspec/globalcfg.py Lines 698 to 707 in 564bf83
and a unit test for the override behaviour of cylc-flow/tests/unit/parsec/test_config.py Lines 75 to 77 in 564bf83
|
(There is no single site/user global config dir with the new hierarchy) Also remove site global-tests.cylc functionality, only use user global-tests.cylc
Plus fix a pycodestyle "error"
564bf83
to
7537026
Compare
@MetRonnie a rebase should fix test failure |
7537026
to
c3b030e
Compare
Just undoing & redoing the last commit and force pushing seems to have done the trick, as the tests run on a merge commit (PR branch merged into master). Ideally the tests should re-run when master changes, then. But I don't think that's possible currently |
That's interesting, didn't know it worked like that, Travis CI just checked out your branch locally so you had to rebase to pick up changes which resulted in a couple of false negatives over the years. |
Travis also creates a merge commit to run the tests, e.g. for https://travis-ci.org/github/metomi/isodatetime/builds/725975670 it says " Commit ba1e4c1 " and if you click on the link it shows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, one style comment.
self.SITE_CONF_PATH = (os.getenv('CYLC_SITE_CONF_PATH') or | ||
os.path.join(os.sep, 'etc', 'cylc', 'flow')) | ||
self.USER_CONF_PATH = os.path.join(self._HOME, '.cylc', 'flow') | ||
version_hierarchy = get_version_hierarchy(CYLC_VERSION) | ||
self.CONF_DIR_HIERARCHY = [ | ||
*[(upgrader.SITE_CONFIG, os.path.join(self.SITE_CONF_PATH, ver)) | ||
for ver in version_hierarchy], | ||
*[(upgrader.USER_CONFIG, os.path.join(self.USER_CONF_PATH, ver)) | ||
for ver in version_hierarchy] | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If converting these class attributes to instance attributes make them lower case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was only CONF_DIR_HIERARCHY
that needed to be moved inside __init__
because it's not possible to use another class attribute inside the list comprehension (https://stackoverflow.com/a/13913933/3217306). Seeing as this is the only reason for making it a instance attribute, would it make sense to leave it uppercase if the other two are changed to class attributes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 thanks @MetRonnie
These changes close #3689
Requirements check-list
CONTRIBUTING.md
and added my name as a Code Contributor.