issue callbacks per item and retry fails

- now workers passes queue to task_executor so it can send back events per item and on retry attempt
- updated result class to pass along events to strategy
- base strategy updated to forward new events to callback
- callbacks now remove 'items' on final result but process them directly when invoked per item
- new callback method to deal with retry attempt messages (also now obeys nolog)
- updated tests to match new signature of task_executor

fixes #14558
fixes #14072
This commit is contained in:
James Cammarata
2016-02-23 15:07:06 -05:00
parent 6eb4633b07
commit e02b98274b
7 changed files with 74 additions and 45 deletions

View File

@@ -104,6 +104,19 @@ class ResultProcess(multiprocessing.Process):
time.sleep(0.0001)
continue
# send callbacks for 'non final' results
if '_ansible_retry' in result._result:
self._send_result(('v2_playbook_retry', result))
continue
elif '_ansible_item_result' in result._result:
if result.is_failed() or result.is_unreachable():
self._send_result(('v2_playbook_item_on_failed', result))
elif result.is_skipped():
self._send_result(('v2_playbook_item_on_skipped', result))
else:
self._send_result(('v2_playbook_item_on_ok', result))
continue
clean_copy = strip_internal_keys(result._result)
if 'invocation' in clean_copy:
del clean_copy['invocation']

View File

@@ -113,6 +113,7 @@ class WorkerProcess(multiprocessing.Process):
self._new_stdin,
self._loader,
self._shared_loader_obj,
self._rslt_q
).run()
debug("done running TaskExecutor() for %s/%s" % (self._host, self._task))