Hi, Is there a way to know the size of a ZODB Folder ? Something like "du somefolder" in UNIX ? Thanks in advance ! --Gilles
On Fri, 2002-02-01 at 15:56, Gilles Lenfant wrote:
Hi,
Is there a way to know the size of a ZODB Folder ? Something like "du somefolder" in UNIX ?
No, but it would be easy enough to write a python script which did it. This is a bit of a lazy way of doing it, and I've not tested it beyond a quick go, but try something like: ##parameters=folder=None, size=0 ##title=folder_size if not folder: folder = context for item in folder.objectValues(): if hasattr(item, 'get_size'): size = size + item.get_size() size = size + item.folder_size(size=size) return size
Thanks in advance !
--Gilles
Seb, Many thanks... I'm not that far from the result (got a size of 45769528967274 bytes in the Example folder of Zope 2.5.0 ;-) Arithmetic overflow error in bigger folders... Gonna check what's wrong ... Cheers --Gilles ----- Original Message ----- From: "seb bacon" <seb@jamkit.com> To: "Gilles Lenfant" <glenfant@bigfoot.com> Cc: <zope@zope.org> Sent: Friday, February 01, 2002 5:05 PM Subject: Re: [Zope] Size of a Folder
On Fri, 2002-02-01 at 15:56, Gilles Lenfant wrote:
Hi,
Is there a way to know the size of a ZODB Folder ? Something like "du somefolder" in UNIX ?
No, but it would be easy enough to write a python script which did it. This is a bit of a lazy way of doing it, and I've not tested it beyond a quick go, but try something like:
##parameters=folder=None, size=0 ##title=folder_size
if not folder: folder = context
for item in folder.objectValues(): if hasattr(item, 'get_size'): size = size + item.get_size() size = size + item.folder_size(size=size)
return size
Thanks in advance !
--Gilles
At 06:18 PM 2/1/2002 +0100, Gilles Lenfant wrote:
Seb,
Many thanks... I'm not that far from the result (got a size of 45769528967274 bytes in the Example folder of Zope 2.5.0 ;-) Arithmetic overflow error in bigger folders... Gonna check what's wrong ...
BTW, even though you get the script working, you should be aware how expensive the call is. Zope needs to wake up every single object in a folder; quiet a job for a size call. :-) Regards, Stephan -- Stephan Richter CBU - Physics and Chemistry Student Web2k - Web Design/Development & Technical Project Management
participants (3)
-
Gilles Lenfant -
seb bacon -
Stephan Richter