[Spambayes] locking pickle/dbm against concurrent access?
Anthony Baxter
anthony at interlink.com.au
Tue Jan 21 10:33:46 EST 2003
>>> Skip Montanaro wrote
>
> Depending on how training and classifying are accomplished, it's quite
> possible that the two activities will be done in different processes. For
> example, I am currently experimenting with training using pop3proxy (well,
> still my offshoot proxytrainer at the moment) while classification is being
> done by hammiefilter run from procmail. This implies a need to lock the
> shelve/pickle file used to store the training info. Seems to me we need to
> (be able to) lock the shelve/pickle file. The only lock facility which
> seems cross-platform enough for this application is the set of flags used by
> os.open(). To lock the database you'd have to check/create a lock file
> related (namewise) to the actual database file. Has anyone given this any
> thought?
I'd suggest, instead, that training write to a different filename, then,
when it's complete, rename the new file to the existing file. Real operating
systems will do the right thing - I don't know if Windows will just choke
and die, tho....
--
Anthony Baxter <anthony at interlink.com.au>
It's never too late to have a happy childhood.
More information about the Spambayes
mailing list