1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 01:21:21 +03:00

add logger statement for number of events

This commit is contained in:
AlanCoding 2017-10-06 16:55:31 -04:00
parent 8d19555cf1
commit e814f28039
No known key found for this signature in database
GPG Key ID: FD2C3C012A72926B
2 changed files with 8 additions and 0 deletions

View File

@ -886,6 +886,12 @@ class BaseTask(LogErrorsTask):
try:
stdout_handle.flush()
stdout_handle.close()
# If stdout_handle was wrapped with event filter, log data
if hasattr(stdout_handle, '_event_ct'):
logger.info('%s finished running, producing %s events.',
instance.log_format, stdout_handle._event_ct)
else:
logger.info('%s finished running', instance.log_format)
except Exception:
pass

View File

@ -818,6 +818,7 @@ class OutputEventFilter(object):
def __init__(self, fileobj=None, event_callback=None, raw_callback=None):
self._fileobj = fileobj
self._event_callback = event_callback
self._event_ct = 0
self._raw_callback = raw_callback
self._counter = 1
self._start_line = 0
@ -872,6 +873,7 @@ class OutputEventFilter(object):
self._start_line += n_lines
if self._event_callback:
self._event_callback(event_data)
self._event_ct += 1
if next_event_data.get('uuid', None):
self._current_event_data = next_event_data