librelist archives

« back to archive

Re: [pyres] pyres horde

Re: [pyres] pyres horde

From:
matt george
Date:
2010-08-24 @ 14:05
Scott,
Currently there isn't a way to do anything that is persistent beyond a
single job. The problem that I ran into with this sort of thing is that if
you create a socket to an external resource in the parent, there is a
possibility that the child processes will try and use the same socket.

However, I am working on some job hooks that would allow you to have some
code run before a job, after a job, before fork, and after fork. Hopefully
these will allow for more cases
where external resources are needed. One thing that you might be able to do
is something like this:

conn = create_connection()
class Job(object)

def perform(*args):
     con.do_something()

That might work for each child in the horde process. It should create the
connection the first time it tries to import the job.

Matt

Re: [pyres] pyres horde

From:
Scott Moynes
Date:
2010-08-24 @ 17:05
On 2010-08-24, at 10:05 AM, matt george wrote:
> However, I am working on some job hooks that would allow you to have 
some code run before a job, after a job, before fork, and after fork. 

I think that would work for my situation and would be more generally useful.

Thanks,
scott.