Yo, We have some computational expensive task that we execute as a result of some HTTPRequest. So we spawn a thread and return immediately. Future requests can get the status and thus we can monitor progress at the client side. So far so good. But what should we do when the server restarts before the task finishes ? Onfortunately, pickling the thread and restarting it is not an option (Threads are not picklable (pickleable, pickable ??? ah well what's in a name) :( ) So what are our options here ? Should we turn to Stackless python as a vm or what ? TIA, Sloot
On Tuesday 29 January 2002 08:25 am, Romain Slootmaekers allegedly wrote:
Yo, We have some computational expensive task that we execute as a result of some HTTPRequest. So we spawn a thread and return immediately.
Future requests can get the status and thus we can monitor progress at the client side. So far so good.
But what should we do when the server restarts before the task finishes ?
Onfortunately, pickling the thread and restarting it is not an option (Threads are not picklable (pickleable, pickable ??? ah well what's in a name) :( )
So what are our options here ?
Should we turn to Stackless python as a vm or what ?
TIA,
Sloot
Could you not store the state of the thread in some state storage object (on SystemExit) and pickle that? Then when Zope restarts, have an __init__.py in a Zope product look for that pickle (in a file or ZODB) load it and restart the threaded task where it left off? /---------------------------------------------------\ Casey Duncan, Sr. Web Developer National Legal Aid and Defender Association c.duncan@nlada.org \---------------------------------------------------/
participants (2)
-
Casey Duncan -
Romain Slootmaekers