Whenever I try to use guppy to display ram cache stats in appadmin (using web2py 2.11.2 with up to date appadmin.py/html )
As recommended on the app admin page itself in : "Size of cache: *not available* (requires the Python guppy <http://pypi.python.org/pypi/guppy/> library)" I get a ticket as soon as there are some entries in the ram cache. This both under Mac os/rocket and ubuntu/wsgi with "latest" guppy pip installed This looks like an issue with guppy using __import__ on its own name (after having been successfully imported from sys path) ending up in web2py custom_importer and trying/failing to re-load guppy as local module... Anybody got appadmin to display ram cache size recently ? or has an idea about what's wrong there ? I was never able to use it since r2.5.1, and just gave a new try now. but did not find any recent report about it in the group... Thanks for your help. Bernard stack trace follows <type 'exceptions.ImportError'> Cannot import module 'applications.app.modules.guppy' Traceback (most recent call last): File "/var/gitwf/web2py/gluon/restricted.py", line 227, in restricted exec ccode in environment File "/var/gitwf/web2py/applications/app/controllers/appadmin.py" <https://partner.appibuddy.com/admin/edit/appibuddy8/controllers/appadmin.py>, line 671, in <module> File "/var/gitwf/web2py/gluon/globals.py", line 412, in <lambda> self._caller = lambda f: f() File "/var/gitwf/web2py/applications/app/controllers/appadmin.py" <https://partner.appibuddy.com/admin/edit/appibuddy8/controllers/appadmin.py>, line 458, in ccache ram['bytes'] += hp.iso(value[1]).size File "/usr/local/lib/python2.7/dist-packages/guppy/etc/Glue.py", line 45, in __getattr__ return self._share.getattr(self, name) File "/usr/local/lib/python2.7/dist-packages/guppy/etc/Glue.py", line 195, in getattr d = self.getattr2(inter, cache, owner, name) File "/usr/local/lib/python2.7/dist-packages/guppy/etc/Glue.py", line 215, in getattr2 x = self.getattr3(inter, name) File "/usr/local/lib/python2.7/dist-packages/guppy/etc/Glue.py", line 285, in getattr3 x = getattr(pa, name) File "/usr/local/lib/python2.7/dist-packages/guppy/etc/Glue.py", line 45, in __getattr__ return self._share.getattr(self, name) File "/usr/local/lib/python2.7/dist-packages/guppy/etc/Glue.py", line 195, in getattr d = self.getattr2(inter, cache, owner, name) File "/usr/local/lib/python2.7/dist-packages/guppy/etc/Glue.py", line 215, in getattr2 x = self.getattr3(inter, name) File "/usr/local/lib/python2.7/dist-packages/guppy/etc/Glue.py", line 311, in getattr3 x = f() File "/usr/local/lib/python2.7/dist-packages/guppy/heapy/UniSet.py", line 2177, in _get_iso return self.fam_IdentitySet File "/usr/local/lib/python2.7/dist-packages/guppy/etc/Glue.py", line 45, in __getattr__ return self._share.getattr(self, name) File "/usr/local/lib/python2.7/dist-packages/guppy/etc/Glue.py", line 195, in getattr d = self.getattr2(inter, cache, owner, name) File "/usr/local/lib/python2.7/dist-packages/guppy/etc/Glue.py", line 215, in getattr2 x = self.getattr3(inter, name) File "/usr/local/lib/python2.7/dist-packages/guppy/etc/Glue.py", line 311, in getattr3 x = f() File "/usr/local/lib/python2.7/dist-packages/guppy/heapy/UniSet.py", line 2141, in _get_fam_IdentitySet def _get_fam_IdentitySet(self):return self.IdentitySetFamily(self) File "/usr/local/lib/python2.7/dist-packages/guppy/heapy/UniSet.py", line 1506, in __init__ AtomFamily.__init__(self, mod) File "/usr/local/lib/python2.7/dist-packages/guppy/heapy/UniSet.py", line 887, in __init__ Family.__init__(self, mod) File "/usr/local/lib/python2.7/dist-packages/guppy/heapy/UniSet.py", line 707, in __init__ self.disjoints = mod.immnodeset() File "/usr/local/lib/python2.7/dist-packages/guppy/heapy/ImpSet.py", line 22, in immnodeset return self.sets.immnodeset(it, self._hiding_tag_) File "/usr/local/lib/python2.7/dist-packages/guppy/etc/Glue.py", line 45, in __getattr__ return self._share.getattr(self, name) File "/usr/local/lib/python2.7/dist-packages/guppy/etc/Glue.py", line 195, in getattr d = self.getattr2(inter, cache, owner, name) File "/usr/local/lib/python2.7/dist-packages/guppy/etc/Glue.py", line 213, in getattr2 x = self.getattr_package(inter, name) File "/usr/local/lib/python2.7/dist-packages/guppy/etc/Glue.py", line 250, in getattr_package x = __import__(self.makeName(name), globals(), locals()) File "/var/gitwf/web2py/gluon/custom_import.py", line 89, in custom_importer raise ImportError, 'Cannot import module %s' % str(e) ImportError: Cannot import module 'applications.app.modules.guppy' On Monday, 3 March 2014 06:51:28 UTC+8, Joe Barnhart wrote: > > I'm getting this same error when I try to use guppy to see the cache > storage using the built-in "cache" page of the web2py admin interface. I'm > using a Mac and I saw a ton of warnings about int vs. long precision loss > when I used pip to install guppy. Dunno if that makes a difference, > however. I am able to import guppy manually using "import guppy" but I > haven't played with it other than that. > > -- Joe > > On Thursday, February 20, 2014 8:01:05 PM UTC-8, David Phillips wrote: >> >> My app uses web2py as a background task (as described in Ch. 4 of the >> web2py docs). I have a slow memory leak in the background task. I'm trying >> to run guppy periodically to find it but I am getting a error when I try to >> use it. >> >> The relevant part of my code looks like this: >> >> import guppy >> heapy = guppy.hpy() >> while True: >> ... >> logging.info ("%s" % heapy.heap()) >> >> >> When the last statement executes, I get an ImportError exception. The end >> of the stack trace looks like this: >> >> File "/Users/davidp/dev/python/ssk/gluon/custom_import.py", line 81, in >> custom_importer >> >> raise ImportError, 'Cannot import module %s' % str(e) >> >> ImportError: Cannot import module 'guppy' >> >> >> This code executes fine in the interpreter so I'm guessing the problem >> has to do with web2py's import mechanism. >> >> Has anyone else been successful using guppy/heapy with web2py? I see that >> this isn't the first time this issue has come up but I don't see any >> mention of a solution. >> >> Any help would be gratefully received. >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

