G'day,

I know nothing about how to solve your problem, though it does sound like 
something that interests me and which I would like to do myself. I currently 
have a controller feeding data into a shared-memory circular buffer, from which 
an entirely separate application reads and executes in it's own time. I return 
a 400 OK to the client as soon as the controller is finished validating the 
request and stores it in the buffer; the client must then poll the server to 
get updates on the status of the request once it is in the buffer. Returning 
201 Accepted sounds like a better solution, could you please let me know how 
successful you are in implementing it under pylons and how it works for you?

Thanks a lot,

Chris Van Schaijik
  

> Date: Tue, 3 Mar 2009 12:57:39 -0800
> Subject: Pylons, HTTP 201 Accepted, Task Queues and Background threads
> From: [email protected]
> To: [email protected]
> 
> 
> Hi everyone,
> 
> I'm trying to find some docs or perhaps old discussions about
> implementing a task queue within a pylons application. The scenario
> I'm trying to support involves a request coming into the app server to
> perform an action which takes a long time to complete, such as
> rebuilding an index or updating a value across hundreds of thousands
> of objects.
> 
> My thought was to create a processing thread when the app is loaded.
> When I get the request I add the item to a synchronized queue (which
> the processing thread blocks on) and return a HTTP 201 Accepted to the
> client. The processing thread picks up tasks from the queue and they
> are completed in the order received. The 201 response also has an
> additional Location header to poll the status of the task.
> 
> The question that remained was how to create and manage processing
> thread. I've read a couple of threads on this subject, and hunted
> around google a bit and found a couple of options:
>   -
> http://groups.google.com/group/pylons-discuss/browse_thread/thread/e30fb912ca79b000/7cc1d4a6b1d9919d?lnk=gst&q=background#7cc1d4a6b1d9919d
>   -
> http://groups.google.com/group/pylons-discuss/browse_thread/thread/3e9dfda05af50634/bc914b96e2b96a1b?lnk=gst&q=background#bc914b96e2b96a1b
> 
> Now I'm leaning towards creating a process using the python
> multiprocessing module which interfaces like a thread but skips issues
> with the GIL and pylons thread management. However, I didn't find any
> information about how to manage the process lifecycle and allow it to
> shutdown gracefully when the server is stopped.
> 
> I'd appreciate feedback on this approach and any pointers to resources
> that will allow me to hook into the app lifecycle and manage my
> subprocess as well. Hopefully I can get a working recipe out of this
> and put it all together in the pylons cook book for future reference.
> 
> Thanks.
> 
> > 

_________________________________________________________________
View photos of singles in your area. Click Here
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fdating%2Eninemsn%2Ecom%2Eau%2Fchannel%2Findex%2Easpx%3Ftrackingid%3D1046247&_t=773166080&_r=Hotmail_Endtext&_m=EXT
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to