Keep order while using multiprocessing in Python -


Please note how I can place commands while using multiprocessing in Python. Thanks to both the fanks and some fader returns lists,

  result = [] def callback (* args): results.append (* args) def in_parallel (fn, func): print process started ', For time.strftime ('% H:% M:% S ') pool = mp.Pool (processes = 4) num, I calculate (somefunc (fn)): pool.apply_async (func, args = ( I,), callback = callback ([num, callback])) pool.close () pool.join () Return results    

The problem is resolved with:

  r = pool.map_async (...) r.wait ()    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -