On 5/4/07, Matt Billenstein <[EMAIL PROTECTED]> wrote:
>
> On Fri, May 04, 2007 at 05:27:42PM -0700, Shannon -jj Behrens wrote:
> > On 5/4/07, Matt <[EMAIL PROTECTED]> wrote:
> > > Hi, I have a pylons app which I want to spawn a long-running process
> > > from.  While this process is running (might be an hour or so), I want
> > > the page that kicked off this process to just display status (maybe
> > > referesh ever 30 seconds or so)...  Does anyone have some pointers on
> > > how this should be done or what packages I should be looking into?
> >
> > I've done this before, but not in Pylons.  Spawning a long running
> > process or thread is fine.  Watch out for Paste because I think Ian
> > put in some code to watch for runaway threads--it's probably fine.
> > Use a timer and AJAX to have the Web page poll the server to see if
> > the work is done.  (You could use Comet, but polling is probably fine.
> >  Ignore this statement if you don't know what I'm talking about.)  In
> > the best case, you can use a progress bar on the page.  Just work your
> > way through it; I'm sure you'll be fine.
>
> Any recommendations on passing status between the worker thread and the
> controller when it's polling?  I tried just using class variables, but
> they don't seem to get updated between the threads...

How were you updating the class variable?  ClassName.variable = "foo"?
 If you do self.variable = "foo", you're shadowing the class variable.
 By the way, naturally, watch out for race conditions.  Another option
is to use the queue module and have the worker thread push messages
onto the queue, and the controller can read messages from the queue.
I tend to prefer message queues over explicit lock management.

Best Regards,
-jj

-- 
http://jjinux.blogspot.com/

--~--~---------~--~----~------------~-------~--~----~
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