Skip to content
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

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

oliver-sanders
Copy link
Member

@oliver-sanders oliver-sanders commented Aug 28, 2024

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.cfg (and conda-environment.yml if present).
  • Tests are included (or explain why tests are not needed).
  • Changelog entry - too minor to warrant an entry
  • Cylc-Doc pull request opened if required at cylc/cylc-doc/pull/XXXX.
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@oliver-sanders oliver-sanders added the could be better Not exactly a bug, but not ideal. label Aug 28, 2024
@oliver-sanders oliver-sanders added this to the 8.3.4 milestone Aug 28, 2024
@oliver-sanders oliver-sanders self-assigned this Aug 28, 2024
@oliver-sanders oliver-sanders marked this pull request as ready for review August 28, 2024 10:09
@oliver-sanders oliver-sanders added bug Something is wrong :( and removed could be better Not exactly a bug, but not ideal. labels Aug 28, 2024
@oliver-sanders oliver-sanders changed the title broadcast: remove duplicate namespaces broadcast: fix issue with multiple namespaces Aug 28, 2024
* 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 []:
Copy link
Member

@wxtim wxtim Aug 28, 2024

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 []
):
    # ...

Copy link
Member Author

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.

Copy link
Member

@wxtim wxtim left a 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.

@oliver-sanders
Copy link
Member Author

Additional functional review performed here: #6334 (comment)

@oliver-sanders
Copy link
Member Author

Merging with 1 1/2 reviews.

@oliver-sanders oliver-sanders merged commit 574361b into cylc:8.3.x Aug 30, 2024
27 checks passed
@oliver-sanders oliver-sanders deleted the 6334 branch August 30, 2024 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is wrong :(
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broadcast: GraphQLLocatedError 'DurationFloat' object has no attribute 'startswith'
2 participants