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

performance improvement: stop iterating runner dunder #53553

Closed
wants to merge 8 commits into from

Conversation

mattp-
Copy link
Contributor

@mattp- mattp- commented Jun 20, 2019

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.

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.
@mattp- mattp- requested a review from a team as a code owner June 20, 2019 20:49
regardless of copying a function obj there is still only one
__globals__. Lets just use the lazyloader decorator entirely instead.
Copy link
Contributor

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

@mattp-
Copy link
Contributor Author

mattp- commented Jun 27, 2019

@DmitryKuzmenko should be to good now 👍

Copy link
Contributor

@marbx marbx left a 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!

@marbx
Copy link
Contributor

marbx commented Apr 28, 2020

Oh good.

@sagetherage sagetherage added the develop Pointing to develop branch; needs rebase label May 23, 2020
@sagetherage sagetherage added this to the Blocked milestone May 26, 2020
@sagetherage
Copy link
Contributor

@mattp- can you rebase this against master or perhaps there is another PR to reference, here?

@sagetherage
Copy link
Contributor

Closing as per author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
develop Pointing to develop branch; needs rebase Reviewers-Assigned
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants