-
Notifications
You must be signed in to change notification settings - Fork 71
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
Conversation
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.
65030de
to
844d696
Compare
@@ -68,6 +79,17 @@ def cli(args): | |||
|
|||
|
|||
def main(): | |||
profile_enabled = os.environ.get('LEAPP_CPROFILE', '0') == '1' |
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.
Cold you tourn the check of env var to fuction and move it to stdlib config?
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.
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?
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.
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 |
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.
instead of this try/except use:
from six import StringIO
sortby = 'cumulative' | ||
ps = pstats.Stats(pr, stream=s).sort_stats(sortby) | ||
ps.print_stats() | ||
print(s.getvalue()) |
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'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' |
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.
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?
Co-Authored-By: pirat89 <[email protected]>
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:
|
Closing in favor of #676 |
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.