Nick Craig-Wood wrote:
> Tim Williams <[EMAIL PROTECTED]> wrote:
>> On 18/06/07, Nick Craig-Wood <[EMAIL PROTECTED]> wrote:
>> On Windows the open-a-file-for-writing method works well, but as *nix
>> doesn't work the same way then maybe the socket solution is the best
>> cross-platform option.
En Mon, 18 Jun 2007 16:30:05 -0300, Nick Craig-Wood <[EMAIL PROTECTED]>
escribió:
> Tim Williams <[EMAIL PROTECTED]> wrote:
>> You can also do this by holding a file open in write mode until the
>> script has finished.
>>
>>try:
>> open('lock.txt','w')
>> my_scr
Tim Williams <[EMAIL PROTECTED]> wrote:
> On 18/06/07, Nick Craig-Wood <[EMAIL PROTECTED]> wrote:
> On Windows the open-a-file-for-writing method works well, but as *nix
> doesn't work the same way then maybe the socket solution is the best
> cross-platform option.
Actually you could combine y
Jeff McNeil <[EMAIL PROTECTED]> wrote:
> I've got a rather large log processing job here that has the same
> requirement. I process and sort Apache logs from an 8-way cluster. I
> sort and calculate statistics in 15-minute batch jobs. Only one copy
> should run at once.
>
> I open a file and
Note that in real life, the script exits cleanly if another copy is running...
On 6/18/07, Jeff McNeil <[EMAIL PROTECTED]> wrote:
> I've got a rather large log processing job here that has the same
> requirement. I process and sort Apache logs from an 8-way cluster. I
> sort and calculate statist
I've got a rather large log processing job here that has the same
requirement. I process and sort Apache logs from an 8-way cluster. I
sort and calculate statistics in 15-minute batch jobs. Only one copy
should run at once.
I open a file and lock it via something like this:
import fcntl
fhandle
On 6/18/07, Robin Becker <[EMAIL PROTECTED]> wrote:
> Evan Klitzke wrote:
> > Another method that you can use is to open up a socket on some
> > predetermined port (presumably above 1024), and then have your program
> > try to connect to that port and "talk" to the other program to
> > determine wh
On 18/06/07, Nick Craig-Wood <[EMAIL PROTECTED]> wrote:
> Tim Williams <[EMAIL PROTECTED]> wrote:
> > You can also do this by holding a file open in write mode until the
> > script has finished.
> >
> >try:
> > open('lock.txt','w')
> > my_script()
> > except:
Robin Becker <[EMAIL PROTECTED]> wrote:
> I looked at the temporary files idea, but I'm not certain about the exact
> details. Normally your create a file and then remove it whilst keeping the
> file
> handle; that allows your program to write to it whilst guaranteeing that it
> will
> van
Tim Williams <[EMAIL PROTECTED]> wrote:
> You can also do this by holding a file open in write mode until the
> script has finished.
>
>try:
> open('lock.txt','w')
> my_script()
> except:
>#print script is already running
That only works under w
Robin Becker wrote:
> I wish to prevent a python script from running twice; it's an hourly job, but
> can take too long.
>
> My simplistic script looks like
>
>
> ...
> def main():
> fn = 'MARKER'
> if os.path.isfile(fn):
> log('%s: hourly job running already' % formatTi
On 18/06/07, Robin Becker <[EMAIL PROTECTED]> wrote:
> Wildemar Wildenburger wrote:
> > Robin Becker wrote:
> .
> >
> > Well I can think of a dumb way: create a temporary file during the
> > transaction and have your script check for that before running its main
> > body.
> >
> >
> > I thin
On 6/18/07, Robin Becker <[EMAIL PROTECTED]> wrote:
> Evan Klitzke wrote:
>
>
> >
> > Another method that you can use is to open up a socket on some
> > predetermined port (presumably above 1024), and then have your program
> > try to connect to that port and "talk" to the other program to
Wildemar Wildenburger wrote:
> Robin Becker wrote:
>
> Well I can think of a dumb way: create a temporary file during the
> transaction and have your script check for that before running its main
> body.
>
>
> I think thats the most hassle free way of doing it.
> /W
I looked at the te
Evan Klitzke wrote:
>
> Another method that you can use is to open up a socket on some
> predetermined port (presumably above 1024), and then have your program
> try to connect to that port and "talk" to the other program to
> determine whether or not to run (or whether to do some of the
On 6/18/07, Tim Williams <[EMAIL PROTECTED]> wrote:
> On 18/06/07, Evan Klitzke <[EMAIL PROTECTED]> wrote:
> > On 6/18/07, Robin Becker <[EMAIL PROTECTED]> wrote:
> > > I wish to prevent a python script from running twice; it's an hourly job,
> > > but
> > > can take too long.
> > >
> > > My simpl
On 18/06/07, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote:
> Robin Becker wrote:
> > I wish to prevent a python script from running twice; it's an hourly job,
> > but
> > can take too long.
> >
> > [snip]
> > but it occurs to me that I might be killed with prejudice during the long
> > running
On 18/06/07, Evan Klitzke <[EMAIL PROTECTED]> wrote:
> On 6/18/07, Robin Becker <[EMAIL PROTECTED]> wrote:
> > I wish to prevent a python script from running twice; it's an hourly job,
> > but
> > can take too long.
> >
> > My simplistic script looks like
> >
> >
> > ...
> > def main():
> >
Robin Becker wrote:
> I wish to prevent a python script from running twice; it's an hourly job, but
> can take too long.
>
> [snip]
> but it occurs to me that I might be killed with prejudice during the long
> running work(). Is there a smart way to avoid running simultaneously.
>
Well I can
On 6/18/07, Robin Becker <[EMAIL PROTECTED]> wrote:
> I wish to prevent a python script from running twice; it's an hourly job, but
> can take too long.
>
> My simplistic script looks like
>
>
> ...
> def main():
> fn = 'MARKER'
> if os.path.isfile(fn):
> log('%s: hourly job
20 matches
Mail list logo