On 5/17/2011 7:29 AM tax botsis said...
Part of my code includes the following script, which both shows a
progress bar (for as long as 'categorize_reports()' is executed) and
prints the fileid and the output of the 'document' function; the latter
is the one increasing the calculation time (please see my comment). Any
ideas on how to use all the cores of my CPU here?

A python instance lives it life on a single processor. Accessing multiple cores requires you start multiple python instances. You'd need to restructure to provide some form of cooperative independent processing. Pyro, stackless, and twisted come to mind. It looks like the info at http://wiki.python.org/moin/ParallelProcessing is more up to date than my memory...

Emile




...
def categorize_reports():
     if __name__ == '__main__':
         root2 = Tkinter.Tk(className=' Processing Progress')
         m = Meter(root2, relief='ridge', bd=3)
         m.pack(fill='x')
         i=0.0
         for fileid in fileids():
             m.set(i, 'Processing will take a few minutes...')
             i=i+1.000/len(fileids())
             m.after(1000, lambda: _demo(m, i))
             print str(fileid), document(fileid) #this slows down the
process
         root2.withdraw()
...

Thanks
Tax



_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to