[master] Matchers can self-reference the loader - #64607
Conversation
|
Okay yeah this works and it drops our pillar topfile matching from ~4-5s to <200ms |
|
Can you please address the Thanks! |
|
@s0undt3ch This also requires a change to pytest-salt-factories because that hardcodes a list of dunders. We might also need to add this new dunder to a few of the other loader functions too, like |
|
fyi half of the pre-commit hooks fail on python3.11 because you're pinning ancient library versions that don't support 3.11, mostly because they're trying to import |
468b8ad to
b96c838
Compare
| if ext_dirs: | ||
| if ext_type_dirs is None: | ||
| ext_type_dirs = "{}_dirs".format(tag) | ||
| ext_type_dirs = f"{tag}_dirs" |
There was a problem hiding this comment.
Annoyingly pre-commit has made a mess of this patch including unrelated changes.
It would be better to pyupgrade/black/isort the whole repo in a single commit so contributor patches can be as clean as possible
There was a problem hiding this comment.
I agree this could be done in a bulk or several smaller PRs. That said, for now you could also separate the your changes from pre-commit's in two separate commits. I think --no-verify can accomplish that.
Required for saltstack/salt#64607 Signed-off-by: Joe Groocock <jgroocock@cloudflare.com>
dwoz
left a comment
There was a problem hiding this comment.
I'm good with this when it has more tests. 👍
twangboy
left a comment
There was a problem hiding this comment.
This needs a few tests. And a rebase.
twangboy
left a comment
There was a problem hiding this comment.
Please create a changelog for this
Add changelog entry for PR saltstack#64607 and replace the now-obsolete test_matchers_from_context test (which tested __context__ caching) with tests that verify __matchers__ is injected and never causes recursive salt.loader.matchers() calls.
This makes it so a loaded matcher doesn't have to load another instance of the loader itself and can instead reuse the existing matchers that are already loaded. This should speed up many matcher operations considerably. Signed-off-by: Joe Groocock <jgroocock@cloudflare.com>
Add changelog entry for PR saltstack#64607 and replace the now-obsolete test_matchers_from_context test (which tested __context__ caching) with tests that verify __matchers__ is injected and never causes recursive salt.loader.matchers() calls.
This makes it so a loaded matcher doesn't have to load another instance of the loader itself and can instead reuse the existing matchers that are already loaded. This should speed up many matcher operations considerably.
This is an alternative approach to #64606 which performs the same but is much much cleaner
What does this PR do?
What issues does this PR fix or reference?
Fixes: #61950
Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.
Commits signed with GPG?
Yes/No
Please review Salt's Contributing Guide for best practices.
See GitHub's page on GPG signing for more information about signing commits with GPG.