¡@

Home 

python Programming Glossary: q.put

Python multiprocessing global variable updates not returned to parent

http://stackoverflow.com/questions/11055303/python-multiprocessing-global-variable-updates-not-returned-to-parent

q multiprocessing.Queue p multiprocessing.Process target q.put args Thing p.start print q.get p.join Output python mp.py got..

Python: Multicore processing?

http://stackoverflow.com/questions/1182315/python-multicore-processing

from multiprocessing import Process Queue def do_sum q l q.put sum l def main my_list range 1000000 q Queue p1 Process target..

Clean way to get near-LIFO behavior from multiprocessing.Queue? (or even just *not* near-FIFO)

http://stackoverflow.com/questions/12042575/clean-way-to-get-near-lifo-behavior-from-multiprocessing-queue-or-even-just-n

as mp import Queue q mp.Queue for i in xrange 1000 q.put i deltas while True try value1 q.get timeout 0.1 value2 q.get..

Scapy fails to sniff packets when using multiple threads

http://stackoverflow.com/questions/16279661/scapy-fails-to-sniff-packets-when-using-multiple-threads

count 10 filter icmp and src 0 .format m_dst prn lambda x q.put x m_finished True def threaded_sniff q Queue sniffer Thread..

Threading in python: retrieve return value when using target= [duplicate]

http://stackoverflow.com/questions/2577233/threading-in-python-retrieve-return-value-when-using-target

s grep MemFree proc meminfo sed 's ^0 9 g ' ' servername q.put res.read .strip # ... import threading queue q queue.Queue threading.Thread..

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

t.daemon True t.start try for url in open 'urllist.txt' q.put url.strip q.join except KeyboardInterrupt sys.exit 1 This one..

python multithreading for dummies

http://stackoverflow.com/questions/2846653/python-multithreading-for-dummies

import urllib2 # called by each thread def get_url q url q.put urllib2.urlopen url .read theurls '''http google.com http yahoo.com'''.split..

Can I use a multiprocessing Queue in a function called by Pool.imap?

http://stackoverflow.com/questions/3827065/can-i-use-a-multiprocessing-queue-in-a-function-called-by-pool-imap

as mp import time def f args x args 0 q args 1 q.put str x time.sleep 0.1 return x x def main q mp.Queue pool mp.Pool.. multiprocessing as mp import time q mp.Queue def f x q.put str x return x x def main pool mp.Pool results pool.imap_unordered.. dispatch methods. import multiprocessing as mp def f x f.q.put 'Doing ' str x return x x def f_init q f.q q def main jobs range..

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

args q arr proc.daemon True proc.start for i in range 3 q.put 'data' # Wait for the computation to finish q.join print arr.shape.. the computation to finish q.join print arr.shape print arr q.put 'done' proc.join Running yields rnd 53 10 53 53 53 53 53 53..

Multiprocessing Queue in Python

http://stackoverflow.com/questions/6672525/multiprocessing-queue-in-python

'hi' 'there' 'how' 'are' 'you' 'doing' for item in source q.put item print q close q.join #q.close print Finished everything...... 'hi' 'there' 'how' 'are' 'you' 'doing' for item in source q.put item q.join for p in procs q.put None q.join for p in procs.. for item in source q.put item q.join for p in procs q.put None q.join for p in procs p.join print Finished everything......

Throughput differences when using coroutines vs threading

http://stackoverflow.com/questions/9247641/throughput-differences-when-using-coroutines-vs-threading

print Signal Received return else print Added item s item q.put item for i in range 4 workers.append gevent.spawn worker random.randint.. call that yields control info d Added item s pid item q.put item info d Signal Received pid Don't execute code at a module..

Turn functions with a callback into Python generators?

http://stackoverflow.com/questions/9968592/turn-functions-with-a-callback-into-python-generators

the processing is done # Producer def my_callback x q.put x def task ret scipy.optimize.fmin func x0 callback my_callback.. task ret scipy.optimize.fmin func x0 callback my_callback q.put job_done end_callback ret # Returns the result of the main call.. to use task_done and join . # Producer def my_callback x q.put x q.join # Blocks until task_done is called # Consumer while..