Re: Best practice for variables shared between processes?

2010-09-25 Thread Simon Wistow
On Sat, Sep 25, 2010 at 10:16:40PM +0100, Mark Fowler said: > On Wed, Sep 22, 2010 at 5:51 PM, Simon Wistow wrote: > > > Redis doesn't have queues (i.e deliver to only one subscriber), it only > > has topics (deliver to all subscribers). > > Can't I just BLPOP? > > http://code.google.com/p/redi

Re: Best practice for variables shared between processes?

2010-09-25 Thread Mark Fowler
On Wed, Sep 22, 2010 at 5:51 PM, Simon Wistow wrote: > Redis doesn't have queues (i.e deliver to only one subscriber), it only > has topics (deliver to all subscribers). Can't I just BLPOP? http://code.google.com/p/redis/wiki/BlpopCommand Mark.

Re: Best practice for variables shared between processes?

2010-09-22 Thread Simon Wistow
On Wed, Sep 22, 2010 at 07:49:07AM +0100, Leon Brocard said: > > Use a queue? > > ... instead of writing yet more software. A couple are: > > > ApacheMQ | RabbitMQ | Beanstalkd > > And probably also Redis. I've used all of them and would probably > recommend Redis for something lightweight and R

Re: Best practice for variables shared between processes?

2010-09-22 Thread Léon Brocard
On 20 September 2010 17:43, Peter Edwards wrote: > On 20 September 2010 17:30, Roger Burton West wrote: > >> I wish to have two processes, a "producer" (which will create files) and >> a "consumer" When hearing those two words you should automatically think... > Use a queue? ... instead of wri

Re: Best practice for variables shared between processes?

2010-09-21 Thread Peter Flanigan
When implementing the producer/consumer pattern within a file system I use these guidelines. Pick a directory writeable by the producer, readable by the consumer (this method only uses one directory to avoid file system boundary issues). Have the producer write a file with a name that matches

Re: Best practice for variables shared between processes?

2010-09-21 Thread Peter Haworth
On Tue, 21 Sep 2010 19:07:07 +1000, Daniel Pittman wrote: > David Alban writes: > > On Mon, Sep 20, 2010 at 4:13 PM, Daniel Pittman > > wrote: > >> Just make sure it is a move, not a copy, of the file; at least > >> one developer around me has dropped in File::Copy::move when they > >> got a plai

Re: Best practice for variables shared between processes?

2010-09-21 Thread Nigel Metheringham
If you want something in between the database functionality/requirements of The Schwartz and manually twiddling bits on disk (with a magnet of course - if you are lucky - when I was a lad we had to make our own magnetism) then IPC::DirQueue implements a safe filesystem based IPC mechanism. I have

Re: Best practice for variables shared between processes?

2010-09-21 Thread David Cantrell
On Tue, Sep 21, 2010 at 09:13:19AM +1000, Daniel Pittman wrote: > Just make sure it is a move, not a copy, of the file; at least one developer > around me has dropped in File::Copy::move when they got a plain rename refused > because it crossed devices ??? so ended up copying the data in anyway.

Re: Best practice for variables shared between processes?

2010-09-21 Thread Roger Burton West
On Tue, Sep 21, 2010 at 01:20:08PM +0100, David Cantrell wrote: >My first choice would be to just use the filesystem. Have the >producer(s) write its files somewhere and then mv them to a directory >that the consumer knows about once it's completely written. OK, a bit more detail. This is a pret

Re: Best practice for variables shared between processes?

2010-09-21 Thread David Cantrell
On Mon, Sep 20, 2010 at 05:43:20PM +0100, Peter Edwards wrote: > On 20 September 2010 17:30, Roger Burton West wrote: > > I wish to have two processes, a "producer" (which will create files) and > > a "consumer" (which will do something with them), running > > simultaneously. Ideally the producer

Re: Best practice for variables shared between processes?

2010-09-21 Thread Daniel Pittman
David Alban writes: That has the same failure mode: you can't rename, or hard-link, across separate file systems. This bites if you use File::Temp, which uses /tmp, and your target is somewhere else. Now, a symbolic link might do it, if you didn't count on the receiver deleting the temporary fi

Re: Best practice for variables shared between processes?

2010-09-21 Thread Paul Sharpe
On 20 September 2010 17:30, Roger Burton West wrote: > I wish to have two processes, a "producer" (which will create files) and > a "consumer" (which will do something with them), running > simultaneously. Ideally the producer would push filenames to a list as > it finishes producing them, while t

Re: Best practice for variables shared between processes?

2010-09-21 Thread Alexander Clouter
Roger Burton West wrote: > > I wish to have two processes, a "producer" (which will create files) and > a "consumer" (which will do something with them), running > simultaneously. Ideally the producer would push filenames to a list as > it finishes producing them, while the consumer would shift th

Re: Best practice for variables shared between processes?

2010-09-20 Thread David Alban
if you do need a copy, hard linking would provide, well, not a true copy, but something that could play one on tv. and, like a moved file (in the same filesystem), it benefits from the "copy" springing into existence complete. On Mon, Sep 20, 2010 at 4:13 PM, Daniel Pittman wrote: > Just make su

Re: Best practice for variables shared between processes?

2010-09-20 Thread Dirk Koopman
On 20/09/10 22:15, Mark Fowler wrote: On 20 Sep 2010, at 17:30, Roger Burton West wrote: I wish to have two processes, a "producer" (which will create files) and a "consumer" (which will do something with them), running simultaneously. Ideally the producer would push filenames to a list as it

Re: Best practice for variables shared between processes?

2010-09-20 Thread Daniel Pittman
Mark Fowler writes: > On 20 Sep 2010, at 17:30, Roger Burton West wrote: > >> I wish to have two processes, a "producer" (which will create files) and a >> "consumer" (which will do something with them), running simultaneously. >> Ideally the producer would push filenames to a list as it finishes

Re: Best practice for variables shared between processes?

2010-09-20 Thread Simon Wistow
On Mon, Sep 20, 2010 at 10:17:28AM -0700, Randal L. Schwartz said: > > "Peter" == Peter Edwards writes: > > Peter> http://search.cpan.org/perldoc?TheSchwartz > > I always do a doubletake when I see that module mentioned. > > I don't dare use it for any of my clients... they'll think I named

Re: Best practice for variables shared between processes?

2010-09-20 Thread Roger Burton West
On Mon, Sep 20, 2010 at 10:15:58PM +0100, Mark Fowler wrote: >I had a better thought after my last post. Have one process create >files and, when it's done with each file, atomically move them into a >known directory for the second process to, um, process and delete then >when done. Threads may we

Re: Best practice for variables shared between processes?

2010-09-20 Thread Mark Fowler
On 20 Sep 2010, at 17:30, Roger Burton West wrote: > I wish to have two processes, a "producer" (which will create files) and > a "consumer" (which will do something with them), running > simultaneously. Ideally the producer would push filenames to a list as > it finishes producing them, while th

Re: Best practice for variables shared between processes?

2010-09-20 Thread Peter Edwards
And I spotted this tonight http://octobot.taco.cat/ "Supports AMQP/RabbitMQ, Beanstalk, and Redis PubSub. Others easily addable" On Sep 20, 2010 6:51 PM, "Mark Fowler" wrote: On 20 Sep 2010, at 17:30, Roger Burton West wrote: I wish to have two process... You could use threads instead of proces

Re: Best practice for variables shared between processes?

2010-09-20 Thread Dave Hodgkinson
On 20 Sep 2010, at 17:30, Roger Burton West wrote: > I wish to have two processes, a "producer" (which will create files) and > a "consumer" (which will do something with them), running > simultaneously. Ideally the producer would push filenames to a list as > it finishes producing them, while th

Re: Best practice for variables shared between processes?

2010-09-20 Thread Mark Fowler
On 20 Sep 2010, at 17:30, Roger Burton West wrote: I wish to have two processes, a "producer" (which will create files) and a "consumer" (which will do something with them), running simultaneously. Ideally the producer would push filenames to a list as it finishes producing them, while the consum

Re: Best practice for variables shared between processes?

2010-09-20 Thread Randal L. Schwartz
> "Peter" == Peter Edwards writes: Peter> http://search.cpan.org/perldoc?TheSchwartz I always do a doubletake when I see that module mentioned. I don't dare use it for any of my clients... they'll think I named it after me. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. -

Re: Best practice for variables shared between processes?

2010-09-20 Thread Peter Edwards
On 20 September 2010 17:30, Roger Burton West wrote: > I wish to have two processes, a "producer" (which will create files) and > a "consumer" (which will do something with them), running > simultaneously. Ideally the producer would push filenames to a list as > it finishes producing them, while

Best practice for variables shared between processes?

2010-09-20 Thread Roger Burton West
I wish to have two processes, a "producer" (which will create files) and a "consumer" (which will do something with them), running simultaneously. Ideally the producer would push filenames to a list as it finishes producing them, while the consumer would shift them off the same list (or loop-wait,