-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
performance improvement: stop iterating runner dunder #53553
Conversation
seems some naive iterating of runners in salt.clients.mixin._low was causing all runners to be loaded non-lazily. this is slow and unneccessary, so we update globals on any already loaded mods and use the inject_globals decorator built into LazyLoader instead.
regardless of copying a function obj there is still only one __globals__. Lets just use the lazyloader decorator entirely instead.
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'm ok here except pylint failures.
@DmitryKuzmenko should be to good now 👍 |
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.
Hi @mattp,
congratulations, although I do not yet understand how lazy loading works.
Here you lazyload functions.
Would it also be possible to lazyload a dictionary?
I would like to lazyload grains, which are currently set with
self.opts['grains'] = salt.loader.grains(opts)
Thank you!
Oh good. |
@mattp- can you rebase this against master or perhaps there is another PR to reference, here? |
Closing as per author |
What does this PR do?
seems some naive iterating of runners in salt.clients.mixin._low was
causing all runners to be loaded non-lazily. this is slow and
unneccessary, so we update globals on any already loaded mods and use
the inject_globals decorator built into LazyLoader instead.
this is particularly annoying if runners have noisy or slow virtual funcs.
Previous Behavior
runners loaded all runners all the time.
New Behavior
they are loaded lazily like minion mods
Tests written?
yes
[NOTICE] Bug fixes or features added to Salt require tests.
Please review the test documentation for details on how to implement tests into Salt's test suite.
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.