python Programming Glossary: q.task_done
What is the fastest way to send 100,000 HTTP requests in Python? http://stackoverflow.com/questions/2632520/what-is-the-fastest-way-to-send-100-000-http-requests-in-python status url getStatus url doSomethingWithResult status url q.task_done def getStatus ourl try url urlparse ourl conn httplib.HTTPConnection..
How do I pass large numpy arrays between python subprocesses without saving to disk? http://stackoverflow.com/questions/5033799/how-do-i-pass-large-numpy-arrays-between-python-subprocesses-without-saving-to-d np.random.randint 100 print 'rnd 0 '.format rnd arr rnd q.task_done if __name__ '__main__' N 10 arr shm.zeros N dtype np.uint8 q..
Multiprocessing Queue in Python http://stackoverflow.com/questions/6672525/multiprocessing-queue-in-python completed def worker while True item q.get do_work item q.task_done q multiprocessing.JoinableQueue for i in range num_procs p multiprocessing.Process.. def worker for item in iter q.get None do_work item q.task_done q.task_done q multiprocessing.JoinableQueue procs for i in range.. for item in iter q.get None do_work item q.task_done q.task_done q multiprocessing.JoinableQueue procs for i in range num_procs..
Throughput differences when using coroutines vs threading http://stackoverflow.com/questions/9247641/throughput-differences-when-using-coroutines-vs-threading item s item do_work wid item finally print No more items q.task_done def producer while True item random.randint 1 11 if item 10.. try info d Got item s wid item do_work wid item finally q.task_done info d Done item s wid item def producer pid q for item in iter..
Turn functions with a callback into Python generators? http://stackoverflow.com/questions/9968592/turn-functions-with-a-callback-into-python-generators available if next_item is job_done break yield next_item q.task_done # Unblocks the producer so a new iteration can start Note that.. q.get True timeout # Blocks until an input is available q.task_done # one task_done per get if next_item is job_done break yield.. q.get # Retrieves the dummy object must be after yield q.task_done # Unblocks the producer so a new iteration can start share..
|