-
Notifications
You must be signed in to change notification settings - Fork 47
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
Macos support #69
Macos support #69
Conversation
…ndent from platform
…check await, write tests
…, added requirements
Hi , |
Stupid question: why would we want to support |
I can see some reasons:
|
Hi, thanks for the pull request! I hope I will get to reviewing it at some point in the near future. |
Hi, I took a look at your changes and tried to run it on both Linux on OS X. On Linux, I had to change the requirements to avoid asking for the very latest psycopg2.6.2, as a lot of systems ship with older version of psycopg2, as far as 2.4.5 is known to works normally with pg_view. On OS X, I couldn't run it until I changed the code that calculates the diffs for PostgreSQL process:
On a busy Linux system I observed pg_view crashing every minute or so with I think this problem is not specific to Linux, since psutil is used for both platforms, I just don't have a busy OS X host to check :-) I think it tries to collect statistics for the process that is already gone and doesn't handle this exception gracefully. The original code handled such exceptions and continued working (look, for example, at _read_proc). I like your restructuring of the code into multiple modes, although I think some smaller files (those, describing the constants, factories, exceptions) could be combined into a single one, something like "utils.py" or "misc.py". Unfortunately, in the current state the code is impossible to review, as it's hard to tell the pieces of the code that were changed from those that were moved from pg_view.py into smaller files. I'd propose to split this pull request into several, perhaps, the one that does the code reshuffling without changing the actual code, another one that changes the code without introducing psutils and the third one that adds psuitils. What do you think? |
I've also looked on it and tried to run on my home laptop where I have a python compiled without ipv6 support and it was failing because of that. Besides problems with I think it is already too late to split this pull request into multiple, because usually nobody likes to do the same job twice. May be we should merge it into separate branch, apply all obvious fixes, do some further refactoring and when it would be mature enough merge it to master? |
@CyberDem0n I think we could do this, but it would take much more time to review and get it in shape. |
Although it would be more work for me, I totally agree with @alexeyklyukin. In current state it's very difficult to make a good code review, because this PR contains refactoring + adding psutils at once + it's quite big. Your approach with dividing it to 3 PR would be better. So I'll prepare following pull request:
I will ask you for code-review after every single step, and it should be much easier to review and to achieve working version with psutil support. Thanks for feedback and pointing out issues, I have tested new version on Mac OS + VM with Linux but didn't check these cases, I will take take a look at these issues during second step. I had to mix sth up when handling exceptions ;-) |
Makes sense to me, thank you. This PR is closed. |
Implementation of #60 - Support for OSX(and other platforms). Honestly I didn't expect so many changes, but in order to replace getting data from /proc file with psutil functions I had to do some refactor, write tests. Dividing this script to modules, separating some common logic to classes makes it much easier. Please review and inform me what do you think about that ? I use this script very often and have some ideas what could be useful and I would be willing to implement some new features. I hope that these changes and especially tests, made this code easier to maintain and improve.