Config file support for histogram buckets

This commit is contained in:
Jylpah committed 2020-07-10 20:01:13 +03:00
1 parent d94318a744
commit c36f49555a
1 file changed
+21
+21
View File
@@ -550,6 +550,16 @@ async def main(argv):
except (KeyError, configparser.NoSectionError) as err:
bu.error(exception=err)
try:
if 'ANALYZER' in config.sections():
configAnalyzer = config['ANALYZER']
histogram_fields_str = configAnalyzer.get('histogram_buckets', None)
if histogram_fields_str != None:
set_histogram_buckets(json.loads(histogram_fields_str))
except (KeyError, configparser.NoSectionError) as err:
bu.error(exception=err)
try:
if 'WG' in config.sections():
configWG = config['WG']
@@ -690,6 +700,17 @@ async def main(argv):
if wi != None: await wi.close()
return None
def set_histogram_buckets(json: dict):
global histogram_fields
try:
for field in json.keys():
histogram_fields[field][1] = json[field]
except (KeyError, Exception) as err:
bu.error(exception=err)
return histogram_fields
def process_player_dist(results: list, player_stats: dict, stat_id_map: dict):
"""Process player distribution"""
hist_stats = dict()