1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

now profile_tasks callback handles handlers correctly

fixes #12762
This commit is contained in:
Brian Coca 2015-10-16 18:01:27 -04:00
parent 8effa23ad7
commit 6c8cf8acb7

View file

@ -59,21 +59,20 @@ def tasktime():
class CallbackModule(CallbackBase): class CallbackModule(CallbackBase):
""" """
This callback module provides per-task timing, ongoing playbook elapsed time This callback module provides per-task timing, ongoing playbook elapsed time
and ordered list of top 20 longest running tasks at end. and ordered list of top 20 longest running tasks at end.
""" """
CALLBACK_VERSION = 2.0 CALLBACK_VERSION = 2.0
CALLBACK_TYPE = 'aggregate' CALLBACK_TYPE = 'aggregate'
CALLBACK_NAME = 'profile_tasks' CALLBACK_NAME = 'profile_tasks'
def __init__(self, display): def __init__(self, display):
self.stats = {} self.stats = {}
self.current = None self.current = None
super(CallbackModule, self).__init__(display) super(CallbackModule, self).__init__(display)
def _record_task(self, name):
def playbook_on_task_start(self, name, is_conditional):
""" """
Logs the start of each task Logs the start of each task
""" """
@ -84,6 +83,12 @@ class CallbackModule(CallbackBase):
self.current = name self.current = name
self.stats[self.current] = time.time() self.stats[self.current] = time.time()
def playbook_on_task_start(self, name, is_conditional):
self._record_task(name)
def v2_playbook_on_handler_task_start(self, task):
self._record_task('HANDLER: ' + task.name)
def playbook_on_setup(self): def playbook_on_setup(self):
self._display.display(tasktime()) self._display.display(tasktime())