flock experience

holger krekel pyth at devel.trillke.net
Tue Jan 14 11:50:47 CET 2003


Robin Becker wrote:
> In message <20030114092127.C349 at prim.han.de>, holger krekel
> <pyth at devel.trillke.net> writes
> >Robin Becker wrote:
> .......
> >8 machines?  are you using nfs? then i don't think you should try
> >to do locking.  It's been a problem with smtp+mailprogramms forever
> >and in the end the mailbox format (each message a file) appears to be
> >the simplest working solution.  
> >
> unfortunately I don't know the architecture very well, it's some solaris
> webserver front end, the web people hate putting our (non-java) stuff
> there so they're giving us a standalone document production system.
> >Anyway, couldn't you create a file for each message/process?  another 
> >process could gather it so you wouldn't have to care for locking at all. 
> >you may need an end marker so that the gathering process doesn't
> >assume a message is complete too early. 
> >
> The processes are all cgi-scripts. Currently we have a log file for each
> machine/script. The scripts take about two seconds to complete and the
> (short I hope) log entry is written at termination using
> 
>         f = open(logfile, "a")
>         f.write(text)
>         f.close()

If you have the freedom to choose the logfilename then why
not use a new filename for *each* message?  (that was my
suggestion).  You might want to prepend a timestamp
if you can't reliably access 'mtime' on that machine. 
Reading all the messages in and sorting them is easy.

This is way simpler than any locking scheme. 

    holger





More information about the Python-list mailing list