diff --git a/inventory_provider/routes/jobs.py b/inventory_provider/routes/jobs.py index 019c1f88090a343f9e28ce6db6a2c4aed64d65ac..9b252d1f64f7c974df7440953dd073642cb2ce2c 100644 --- a/inventory_provider/routes/jobs.py +++ b/inventory_provider/routes/jobs.py @@ -53,10 +53,10 @@ TASK_LOG_RESPONSE_SCHEMA = { "$schema": "https://json-schema.org/draft-07/schema#", "type": "object", "properties": { - "pending": {"type": "array", "items": {"type": "string"}}, - "errors": {"type": "array", "items": {"type": "string"}}, - "failed": {"type": "array", "items": {"type": "string"}}, - "warnings": {"type": "array", "items": {"type": "string"}}, + "pending": {"type": "array", "items": {"type": "string"}}, + "errors": {"type": "array", "items": {"type": "string"}}, + "failed": {"type": "array", "items": {"type": "string"}}, + "warnings": {"type": "array", "items": {"type": "string"}}, }, "required": ["pending", "errors", "failed", "warnings"], "additionalProperties": False @@ -198,8 +198,7 @@ def load_task_log(): } found_tasks = False - for task in monitor.load_task_log( - current_app.config['INVENTORY_PROVIDER_CONFIG']).values(): + for task in monitor.load_task_log(current_app.config['INVENTORY_PROVIDER_CONFIG'], {cache_key}).values(): found_tasks = True diff --git a/inventory_provider/tasks/monitor.py b/inventory_provider/tasks/monitor.py index 258c751197ccc4ad584a31aab6e4973e97c71c28..4d7eed5d14f9c7b7b43a2b1211d0f9eebab8b44c 100644 --- a/inventory_provider/tasks/monitor.py +++ b/inventory_provider/tasks/monitor.py @@ -102,7 +102,7 @@ def run(): with app.connection() as connection: recv = app.events.Receiver(connection, handlers={ - '*': _log_event + '*': _log_event }) recv.capture(limit=None, timeout=None, wakeup=True) @@ -163,7 +163,7 @@ def _redis_client_proc(key_queue, value_queue, config_params): value_queue.put(None) -def load_task_log(config_params, ignored_keys=[]): +def load_task_log(config_params, ignored_keys=None): """ load the task log in a formatted dictionary: keys are task uuid's @@ -178,6 +178,10 @@ def load_task_log(config_params, ignored_keys=[]): :param ignored_keys: list of keys to ignore if found :return: """ + + if ignored_keys is None: + ignored_keys = set() + response_queue = queue.Queue() threads = []