homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Victor.Varvariuc
Recipients Nam.Nguyen, Victor.Varvariuc, bquinlan, r.david.murray
Date 2014年01月08日.05:53:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1389160425.39.0.501573639957.issue14119@psf.upfronthosting.co.za>
In-reply-to
Content
Hi Brian,
In one my projects I had to monkey-patch module `concurrent.futures.thread:60`( http://hg.python.org/cpython/file/37caaf21f827/Lib/concurrent/futures/thread.py#l60) with:
def _worker(executor_reference, work_queue):
 try:
 while True:
 work_item = work_queue.get(block=True)
 if work_item is not None:
 work_item.run()
 work_queue.task_done() # <-- added this line
 continue
 executor = executor_reference()
 # Exit if:
 # - The interpreter is shutting down OR
 # - The executor that owns the worker has been collected OR
 # - The executor that owns the worker has been shutdown.
 if futures_thread._shutdown or executor is None or executor._shutdown:
 # Notice other workers
 work_queue.put(None)
 return
 del executor
 except BaseException:
 futures_thread._base.LOGGER.critical('Exception in worker', exc_info=True)
This helps me to control the state of the work queue -- I can see if there are any work items still being processed:
if executor._work_queue.unfinished_tasks:
 # executor is still producing something
 ...
History
Date User Action Args
2014年01月08日 05:53:45Victor.Varvariucsetrecipients: + Victor.Varvariuc, bquinlan, r.david.murray, Nam.Nguyen
2014年01月08日 05:53:45Victor.Varvariucsetmessageid: <1389160425.39.0.501573639957.issue14119@psf.upfronthosting.co.za>
2014年01月08日 05:53:45Victor.Varvariuclinkissue14119 messages
2014年01月08日 05:53:44Victor.Varvariuccreate

AltStyle によって変換されたページ (->オリジナル) /