On Wednesday, August 25, 2010 12:24:31 pm Ed Leafe wrote:
> On Aug 25, 2010, at 3:06 PM, Paul McNett wrote:
> >> Thanks Paul!  One more question... is there any problem calling the
> >> above routine about 25 times in a row?  IOW will it wait while
> >> outputting a file before outputting the next one?
> > 
> > It will run them sequentially unless you provide for multi-thread or
> > multi-process processing. If you want your UI to remain responsive while
> > this stuff runs, then I'd consider making it a completely separate
> > process which you spawn using the subprocess module. You could have a
> > timer fire every 10 seconds or so to poll for a file semaphore somewhere
> > to then present the status screen to the user when the other process
> > finishes.
> 
>       Check out eventlet: http://eventlet.net/  Here's some pseudo-code that
> will run up to 50 blocking processes concurrently; I'm assuming that the
> process is called 'printPDF', and takes a file name as an argument.
> 
> 
> import eventlet
> pool = eventlet.GreenPool(size=50)
> for nm in myFileNames:
>     pool.spawn_n(printPDF, nm)
> with eventlet.Timeout(120):
>     pool.waitall()
> 
> 
>       Much nicer than threads to maintain, and much more memory-efficient!
> 
> 
> 
> -- Ed Leafe

What is the need for the "eventlet.Timeout"?
Johnf
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to