From 61d79e6b1147958efd293f3f2d72430e95156257 2019-03-17 18:30:15 From: Marcin Lulek Date: 2019-03-17 18:30:15 Subject: [PATCH] utils: added get_es_info function --- diff --git a/backend/src/appenlight/lib/utils/__init__.py b/backend/src/appenlight/lib/utils/__init__.py index 463cf75..76eb049 100644 --- a/backend/src/appenlight/lib/utils/__init__.py +++ b/backend/src/appenlight/lib/utils/__init__.py @@ -546,3 +546,13 @@ def in_batches(seq, size): :param size integer """ return (seq[pos : pos + size] for pos in range(0, len(seq), size)) + + +def get_es_info(cache_regions, es_conn): + @cache_regions.memory_min_10.cache_on_arguments() + def get_es_info_cached(): + returned_info = {"raw_info": es_conn.info()} + returned_info["version"] = returned_info["raw_info"]["version"]["number"].split('.') + return returned_info + + return get_es_info_cached()