def qfunc( queue, qglobals ): while True: try: mycall = queue.get( timeout = 5 ) except ( Empty, IOError ): break exec( mycall ) ROOT.gROOT.GetListOfCanvases().Clear() qglobals.nfinished += 1 report_progress( qglobals.nfinished, qglobals.ntotal, 'plots', 'png' ) queue.task_done()
queue = multi.JoinableQueue() qglobals = multi.Manager().Namespace() qglobals.nfinished = 0 qglobals.ntotal = len(calls) for call in calls: queue.put(call) def qfunc(queue, qglobals): from Queue import Empty while True: try: mycall = queue.get(timeout=5) except (Empty, IOError): break exec(mycall) ROOT.gROOT.GetListOfCanvases().Clear() qglobals.nfinished += 1 report_progress(qglobals.nfinished, qglobals.ntotal, 'plots', 'png') queue.task_done() for i in range(24): p = multi.Process(target=qfunc, args=(queue, qglobals)) p.daemon = True p.start() queue.join() report_progress(len(calls), len(calls), 'plots', 'png') print ''
canvas.SaveAs('plots/hMass_15To20_0To0.8_Pass.png') """) queue = multi.JoinableQueue() qglobals = multi.Manager().Namespace() qglobals.nfinished = 0 qglobals.ntotal = len(calls) for call in calls: queue.put(call) def qfunc(queue, qglobals): from Queue import Empty while True: try: mycall = queue.get(timeout=5) except (Empty, IOError): break exec(mycall) ROOT.gROOT.GetListOfCanvases().Clear() qglobals.nfinished += 1 report_progress(qglobals.nfinished, qglobals.ntotal, 'plots', 'png') queue.task_done() for i in range(24): p = multi.Process(target=qfunc, args=(queue, qglobals)) p.daemon = True p.start() queue.join() report_progress(len(calls), len(calls), 'plots', 'png') print ''
""") queue = multi.JoinableQueue() qglobals = multi.Manager().Namespace() qglobals.nfinished = 0 qglobals.ntotal = len(calls) for call in calls: queue.put(call) def qfunc(queue, qglobals): while True: try: mycall = queue.get(timeout=5) except (Empty, IOError): break exec(mycall) ROOT.gROOT.GetListOfCanvases().Clear() qglobals.nfinished += 1 report_progress(qglobals.nfinished, qglobals.ntotal, 'plots', 'root') queue.task_done() for i in range(8): p = multi.Process(target=qfunc, args=(queue, qglobals)) p.daemon = True p.start() queue.join() report_progress(len(calls), len(calls), 'plots', 'root') print ''