BTW, I'll add that I can do this in a simple standalone python script, spawn a thread and have both that thread and the main thread stuff data into a list or something...
thx m On Fri, May 04, 2007 at 06:17:29PM -0700, Matt Billenstein wrote: > > Yeah, I was doing self.status = "blah" in the worker thread... The > thread the controller is in doesn't seem to ever get this value... > > Using Class.status = "blah" doesn't seem to help much either... > > thx > > m > > On Fri, May 04, 2007 at 05:59:15PM -0700, Shannon -jj Behrens wrote: > > > > 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/ > > > > > > > -- > Matt Billenstein > [EMAIL PROTECTED] > http://www.vazor.com/ > > > -- Matt Billenstein [EMAIL PROTECTED] http://www.vazor.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 -~----------~----~----~----~------~----~------~--~---
