Francesc Alted wrote:
> Maybe what you are after is to personalize the behaviour of the `atexit`
> hook when exiting PyTables.  See at:
> 
> http://pytables.org/moin/UserDocuments/AtexitHooks
> 
> and tell me if this helps.

        I don't think it will for two reasons, one serious, the other minor.

1. We can easily open a lot of files as the programs run, say 2000 or 
so.  We may only be using 1/500th of that.  (Roughly we have file for 
each type of data for each day, going over at least two years, and 
roughly estimating using four at a time.)  I'd like to keep the number 
open at any one time small.  And I still don't know when PyTables 
objects disappear from the caches.

2. Sometimes clients may want to use PyTables directly to open other 
files, so changing the defaults to suit my purposes seems improper.

        My problem boils down to this, when the weakref dies, the callback is 
called before the node is finalized.  So if I close the file, the node 
finalization leads to errors.  My current stumbling block is something 
after my callback finishes that tries to access file.root._v__objectID. 
  file.root is gone, so that throws an error.  Any ideas?  (And can 
going down this road possibly lead to problems where the last changes 
aren't flushed to disk?)

        The other possible solutions are (1) to either only check my caches 
occasionally, and if the weakrefs are all invalid, then close the file 
or (2) try to push the closing of the files to a separate thread, which 
is much more complicated, but doable.

-- 
Anthony Foglia
Princeton Consultants
(609) 987-8787 x233


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to