-
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
[[localhost]]
platform selects from top of platforms list
#4845
Comments
On further investigation, I'm not at all sure it's platforms that's at fault:
Commenting out the default platform ConclusionWhat appears to be going on here is that the global config spec always adds Further examination suggests that even then you are getting the hard-set default localhost, and not overridding any of its settings - consider
Possible solutions
@dpmatthews & @oliver-sanders - I'd appreciate your thoughts. |
So I'm suggesting we document not to use
We need
Overriding # global.cylc
[platforms]
[[localhost]]
hosts = foo $ cylc config -i '[platforms][localhost]'
hosts = foo
Isn't this the wrong way around? |
Do I interpret this as you saying that if "localhost" in platform_regex and platform_regex is not "localhost":
raise CylcException("Don't use 'localhost' in a broader regex.") |
Yep, perhaps a warning rather than an exception, if we run the regex we can catch things like if (
# if the platform contains special regular expression characters
re.escape(platform_regex) != platform_regex
# and
and re.match(platform_regex, 'localhost')
):
LOG.warn(f'The platform regex {platform_regex} matches "localhost", however, ...') |
Swapping "bug" for "doc", this behaviour is fine and easy to work around, we just need to document it somewhere. Either a warning in the code, or a line in cylc-doc or both. |
In a conversation with @dpmatthews this morning, it looks like he favours making this an error, not a warning. Also convinced me that it's probably worth bringing the comma separated list and expansion behaviour of the global config more into line with Cylc config. |
* Partially addresses cylc#4845 * This is intended to make it easier to configure the localhost platform to match other hosts e.g `[platform][localhost, desktop..., server...]` * Note this **cannot** be done using a regex e.g. `[platform][localhost|desktop...|server...]` because the localhost platform is special (it gets defined by default as [localhost]) so the regex is not matched and consequently gets ignored - cylc#4845
Items in the The https://github.com/oliver-sanders/cylc-flow/pull/new/parsec-section-expand-many |
[[localhost]]
platform selects from top of platfroms list.[[localhost]]
platform selects from top of platforms list
* Add warning if a platform name regex matches localhost * tests/u: parsec/test_util unittest->pytest * glblcfg: split comma separated platform definitions * Partially addresses #4845 * This is intended to make it easier to configure the localhost platform to match other hosts e.g `[platform][localhost, desktop..., server...]` * Note this **cannot** be done using a regex e.g. `[platform][localhost|desktop...|server...]` because the localhost platform is special (it gets defined by default as [localhost]) so the regex is not matched and consequently gets ignored - #4845 * update changelog * Better handling of [platforms][localhost] convert warning to outright error ensure that failure occurs wherever in hte platforms list the inappropriate regex is. Update tests/functional/platforms/08-warn-if-regex-matches-localhost.t Co-authored-by: Oliver Sanders <[email protected]> removed two tests which will fail (correctly) after changes * response to review Co-authored-by: Oliver Sanders <[email protected]>
Describe the bug
Localhost doesn't seem to follow the same platform selection rules as other platforms - it appears to select the top regex in the list, and not the bottom one!
Steps to reproduce the bug
Given the
global.cylc
:and the
flow.cylc
:then testing for the global init-script in the job script
One would expect both to return "defined last" but in fact this is not the case for localhost.
Pull requests welcome!
This is an Open Source project - please consider contributing a bug fix
yourself (please read
CONTRIBUTING.md
before starting any work though).The text was updated successfully, but these errors were encountered: