Move queuing tasks to a background thread

This commit is contained in:
James Cammarata 2016-08-26 14:55:56 -05:00
commit b71957d6e6
8 changed files with 226 additions and 156 deletions

View file

@ -181,7 +181,9 @@ class StrategyModule(StrategyBase):
any_errors_fatal = False
results = []
items_to_queue = []
for (host, task) in host_tasks:
if not task:
continue
@ -252,14 +254,20 @@ class StrategyModule(StrategyBase):
display.debug("sending task start callback")
self._blocked_hosts[host.get_name()] = True
self._queue_task(host, task, task_vars, play_context)
items_to_queue.append((host, task, task_vars))
self._pending_results += 1
del task_vars
# if we're bypassing the host loop, break out now
if run_once:
break
results += self._process_pending_results(iterator, one_pass=True)
# FIXME: probably not required here any more with the result proc
# having been removed, so there's no only a single result
# queue for the main thread
#results += self._process_pending_results(iterator, one_pass=True)
self._tqm.queue_multiple_tasks(items_to_queue, play_context)
# go to next host/task group
if skip_rest: