-
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
broadcast: fix issue with multiple namespaces #6335
Conversation
* Fix an issue that could cause issues when broadcasting "coerced" configurations to multiple namespaces. * Specifying the same namesapce multiple times doesn't make sense, we should strip duplicates earlier on in the process. * Closes cylc#6334
@@ -280,8 +280,16 @@ def put_broadcast( | |||
bad_namespaces = [] | |||
|
|||
with self.lock: | |||
for setting in settings: | |||
for point_string in point_strings: | |||
for setting in settings or []: |
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.
This is 3 levels nested and in theory could be looping a fair bit. Might it be a nicer read and possibly more efficient with:
from itertools import product
# ...
for setting, point_string, namespace in product(
settings or [], point_strings or [], namespaces or []
):
# ...
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.
I don't think product is more efficient (it will still use for loops under the hood, it cannot change the number of iterations), but flattening this logic might be nicer.
I would rather avoid refactors in bugfix PRs through for risk management purposes.
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.
Reviewed. Possible improvement suggested, but not one which should block merger.
Additional functional review performed here: #6334 (comment) |
Merging with 1 1/2 reviews. |
Check List
CONTRIBUTING.md
and added my name as a Code Contributor.setup.cfg
(andconda-environment.yml
if present).?.?.x
branch.