From 4ee40d58b4bf8d56bb4abde9add6e966f257cf68 Mon Sep 17 00:00:00 2001 From: Astarry Date: Fri, 22 Nov 2024 11:17:03 -0500 Subject: [PATCH] don't inherit root brokers log level --- src/python/phenix_apps/apps/helics/helics.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/python/phenix_apps/apps/helics/helics.py b/src/python/phenix_apps/apps/helics/helics.py index 5363157..1c67926 100644 --- a/src/python/phenix_apps/apps/helics/helics.py +++ b/src/python/phenix_apps/apps/helics/helics.py @@ -55,7 +55,7 @@ def pre_start(self): total_fed_count = 0 - # broker hosts --> ip:port --> fed-count + # broker hosts --> ip:port --> ['fed_count', 'loglevel'] # hosts to create start scripts for, ip:port combos to create sub brokers for brokers = {} federates = self.extract_annotated_topology_nodes('helics/federate') @@ -72,6 +72,7 @@ def pre_start(self): for config in configs: broker = config.get('broker', '127.0.0.1') count = config.get('fed-count', 1) + loglevel = config.get('log-level', 'SUMMARY') total_fed_count += count @@ -105,8 +106,10 @@ def pre_start(self): self.add_label(hostname, 'group', 'helics') self.add_label(hostname, 'helics', 'broker') - entry = brokers.get(hostname, {broker_ip: 0}) - entry[broker] += count + entry = brokers.get(hostname, {broker_ip: [0, None]}) + entry[broker][0] += count + if entry[broker][1] == None: # if log-level is already set for this sub-broker, don't overwrite. + entry[broker][1] = loglevel brokers[hostname] = entry @@ -128,14 +131,15 @@ def pre_start(self): broker_configs = configs.get(hostname, []) # individual sub brokers for host (there will usually just be one) - for endpoint, feds in subs.items(): + for endpoint, fedinfo in subs.items(): root_broker_config['subs'] += 1 - + feds = fedinfo[0] + loglevel = fedinfo[1] broker_configs.append({ 'feds': feds, 'parent': root_ip, 'endpoint': endpoint, - 'log-level': broker_md.get('log-level', 'summary'), + 'log-level': loglevel, 'log-file': os.path.join(log_dir, 'helics-sub-broker.log'), })