Performance improvements

* Speed up serialization of hostvars by simply using the internal
  dictionary used for cached lookups
* Use blocking gets/puts on queues instead of spin locking
* Merge sequential implicitly created blocks
This commit is contained in:
James Cammarata 2015-08-17 13:45:07 -04:00
parent 1d402ae390
commit e7b2308b66
5 changed files with 57 additions and 42 deletions

View file

@ -72,9 +72,9 @@ class ResultProcess(multiprocessing.Process):
self._cur_worker = 0
try:
if not rslt_q.empty():
if rslt_q.qsize() > 0:
debug("worker %d has data to read" % self._cur_worker)
result = rslt_q.get(block=False)
result = rslt_q.get()
debug("got a result from worker %d: %s" % (self._cur_worker, result))
break
except queue.Empty:
@ -102,7 +102,7 @@ class ResultProcess(multiprocessing.Process):
try:
result = self._read_worker_result()
if result is None:
time.sleep(0.1)
time.sleep(0.01)
continue
# if this task is registering a result, do it now