diff --git a/inventory_provider/tasks/monitor.py b/inventory_provider/tasks/monitor.py index d12bd5c489a2e11a801849703a6f6edd9720b892..b976caba59bfc822ec78047292dfff119e7e96ff 100644 --- a/inventory_provider/tasks/monitor.py +++ b/inventory_provider/tasks/monitor.py @@ -164,7 +164,7 @@ def _redis_client_proc(key_queue, value_queue, config_params): value_queue.put(None) -def load_task_log(config_params): +def load_task_log(config_params, ignored_keys=[]): """ load the task log in a formatted dictionary: keys are task uuid's @@ -176,6 +176,7 @@ def load_task_log(config_params): the redis master the cumulative latency causes nginx/gunicorn timeouts :param config_params: app config + :param ignored_keys: list of keys to ignore if found :return: """ response_queue = queue.Queue() @@ -191,8 +192,13 @@ def load_task_log(config_params): r = get_current_redis(config_params) for k in r.scan_iter('joblog:*'): + k = k.decode('utf-8') + if k in ignored_keys: + logger.debug('ignoring key: {k}') + continue + t = random.choice(threads) - t['queue'].put(k.decode('utf-8')) + t['queue'].put(k) # tell all threads there are no more keys coming for t in threads: