New v2_runner_on_start callback added (#47684)

* New v2_runner_on_start callback added to indicate the start of execution for a host in a specific task

* Add changelog fragment

* Minor docstring clarification
This commit is contained in:
Matt Martz 2018-10-30 11:37:11 -05:00 committed by GitHub
parent 7db63851e0
commit fd662c0a63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- callbacks - New ``v2_runner_on_start`` callback added to indicate the start of execution for a host in a specific task (https://github.com/ansible/ansible/pull/47684)

View file

@ -412,3 +412,10 @@ class CallbackBase(AnsiblePlugin):
def v2_runner_retry(self, result): def v2_runner_retry(self, result):
pass pass
def v2_runner_on_start(self, host, task):
"""Event used when host begins execution of a task
.. versionadded:: 2.8
"""
pass

View file

@ -317,6 +317,7 @@ class StrategyBase:
worker_prc = WorkerProcess(self._final_q, task_vars, host, task, play_context, self._loader, self._variable_manager, shared_loader_obj) worker_prc = WorkerProcess(self._final_q, task_vars, host, task, play_context, self._loader, self._variable_manager, shared_loader_obj)
self._workers[self._cur_worker] = worker_prc self._workers[self._cur_worker] = worker_prc
self._tqm.send_callback('v2_runner_on_start', host, task)
worker_prc.start() worker_prc.start()
display.debug("worker is %d (out of %d available)" % (self._cur_worker + 1, len(self._workers))) display.debug("worker is %d (out of %d available)" % (self._cur_worker + 1, len(self._workers)))
queued = True queued = True