Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't inherit root brokers log level #38

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/python/phenix_apps/apps/helics/helics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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'),
})

Expand Down