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

[WIP] Enable profilling when env LEAPP_CPROFILE == '1' #482

Closed
wants to merge 2 commits into from

Conversation

pirat89
Copy link
Member

@pirat89 pirat89 commented Apr 5, 2019

Currently on some machines the run of the leapp / snactor is too
slow. Especially framework itself should be fast but sometimes the
time differences are in order of tens seconds. From this point,
it seems useful to be able to start profilling based on the env
variable when it is needed.

@centos-ci
Copy link

Can one of the admins verify this patch?

Currently on some machines the run of the leapp / snactor is too
slow. Especially framework itself should be fast but sometimes the
time differences are in order of tens seconds. From this point,
it seems useful to be able to start profilling based on the env
variable when it is needed.
@@ -68,6 +79,17 @@ def cli(args):


def main():
profile_enabled = os.environ.get('LEAPP_CPROFILE', '0') == '1'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cold you tourn the check of env var to fuction and move it to stdlib config?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I +1 the idea, I was just thinking about this and I am wondering - Is it relevant that you know it's on for others that this? This is the only use case right now, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This place is the only use case so far. I was thinking if it's worth it to move it to stdlib and I'm kind of indecisive. Maybe it could be moved there if another use case appears. So feel free to dismiss this sugeestion.

# TODO: low possibility of the problem with encoding with Python3;
# # but it should not be so problematic in this case, so keeping now just
# # like that to keep it simple
from io import StringIO
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of this try/except use:

from six import StringIO

leapp/snactor/__init__.py Outdated Show resolved Hide resolved
sortby = 'cumulative'
ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
ps.print_stats()
print(s.getvalue())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather like to see this being printed to stderr

@AloisMahdal what's your take on this?

@@ -68,6 +79,17 @@ def cli(args):


def main():
profile_enabled = os.environ.get('LEAPP_CPROFILE', '0') == '1'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I +1 the idea, I was just thinking about this and I am wondering - Is it relevant that you know it's on for others that this? This is the only use case right now, right?

@leapp-bot
Copy link
Collaborator

Thank you for contributing to the Leapp project!

Please note that every PR needs to comply with the Leapp Guidelines, pass tests and linter checks before it can be merged.

If you want to re-run tests or request review, you can use following commands as a comment:

  • leapp-ci build to run unit tests and copr build
  • e2e tests to run unit tests, copr build and end-to-end tests (OAMG members only)
  • review please to notify leapp developers of review request

@pirat89
Copy link
Member Author

pirat89 commented Nov 3, 2020

Closing in favor of #676

@pirat89 pirat89 closed this Nov 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants