-
Notifications
You must be signed in to change notification settings - Fork 20
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
Replace psutil with resource #99
Conversation
This reverts commit a6d5815.
Pypsutil changes
I realize Travis is complaining. Note cptpcrd/pypsutil#1 Any chance 3.6 can be removed as a supported version? Seems to be fine for 3.7+ |
Hi @haz, great to see you guys using Tarski! |
I tried to run tarski on Windows like in '19... haven't tried again since.. I use tarski regularly on WSL but that doesn't count as "windows" :( I don't think it is prudent to drop support for a platform right away. Is there a workaround for the platform issue? |
I guess I should have left more context... Imagine being able to use the power of tarski in the browser for something like a fully client side plugin on the planning.domains editor. psutil is the only thing standing in the way of the core functionality. @camcunningham already has it working with pypsutil, but swapping that out breaks 3.6 compatibility. gringo integration is being looked at next. Judging by the limited scope of the PR (i.e., the limited use of psutil), could it (the required functionality) not just be replaced entirely? I don't like the idea of maintaining an "online fork", as contributed support tends to drift. |
That'd be great stuff @haz, but I do not think it is reasonable to just say "install WSL" to people that want to use Anaconda on Windows. To be honest, I wasn't even sure why import resource
class Timer:
def __init__(self):
self.start_time = time.time()
self.start_clock = self._clock()
self.start_mem = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
@staticmethod
def _clock():
times = os.times()
return times[0] + times[1]
def __str__(self):
current = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
current_in_mb = current / (1024*1024)
rss_in_mb = (current - self.start_mem) / (1024*1024)
return "[%.2fs CPU, %.2fs wall-clock, diff: %.2fMB, curr: %.2fMB]" % (
self._clock() - self.start_clock,
time.time() - self.start_time, rss_in_mb, current_in_mb) Is the |
That's precisely what I was getting at with...
Not sure if pypsutil rules out windows...it's just Python 3.6 support that breaks afaik. Either way, can you do a quick check @camcunningham to see if @miquelramirez Want the PR to replace it from our end, or would you guys like to handle it? |
No worries @haz the thing is that I wasn't sure which was the functionality in question until I had time to review the PR properly. I think the cleanest thing is that you guys update the PR once you have tested the proposed replacement, and then it can all be merged from the web interface. |
@camcunningham On it? |
Yep, according to their docs, pypsutil does not support Windows. |
On its way...
Pyodide. It's magic ;). |
Going to make the resource change and push soon |
Changed psutil usage to resource
@gfrances Can you trigger another Travis check? |
Perfecto! |
Maintainer of
|
Thanks guys! Actually, looking into the changes, the PR changes the actual functionality of our code, as before, the |
Oomph...what about a fallback on the import? Only get the memory usage if you're on a system that handles |
Thanks @cptpcrd for the info. You're right that the
|
I can try to have a go at this, if you guys don't mind |
Awesome, yes please! |
Thanks @cptpcrd for the very useful comments. I just see the PR is directed to |
That'd be a question for @gfrances We care not who's github username is attached to the commit logs. We just want to minimize the headache of having this embedded in the browser ;). |
No worries about that, I'll go with a commit directly against the devel branch. |
@haz , @camcunningham, what do you guys use to test this? Do you have any sample travis or similar CI environment to show how to set up the testing environment for Pyodide? I pushed some changes into a What is anyway the expected workflow for your application, if I may ask? Is the package precompiled somehow in webassembly on the web server? Is that done on the fly in the user's browser? (just trying to figure out whether you'll go through Pypi, or just run setup.py yourselves, etc.). |
If we can avoid rolling our own, all the better. So far it's been building our own wheel that does the trick, but straight from pypi is the dream. It's why we put in a PR in the first place. |
Sounds good. It'd still be good for me to know how to test these changes in the new branch work in your environment. |
@gfrances currently the testing is purely functional: Getting tarski to load within browser via pyodide's micropip install, then running the some of the code on the docs Getting started portion to see that it's working properly at a glance. Our focus thus far has been getting tarski to load within the pyodide environment within the browser, and not testing much of the libraries functionality yet. |
I see. Is there any script / steps you can share that I could use to test this is working then? |
I'll have a go at it. Just for reference, the steps that I've been taking are as follows:
Note: The html file also has to be hosted via a server so that we don't run into any CORS issues. I've been using this code to determine if we have tarski up and running within pyodide. |
@gfrances On first glance it seems to be working! |
I've released all changes so far into release |
This is the first step towards having tarski work in the browser. A merge + version bump on pip would be tremendously awesome. Cheers!