Skip to content

Commit

Permalink
feat: handle node not found and print logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Arqu committed Jul 8, 2024
1 parent 164e850 commit 5e894e0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions netsim/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,33 @@ def run(nodes, prefix, args, debug=False, visualize=False):
cnt = node_counts[node['connect']['node']]
id = i % cnt
connect_to = '%s_%d' % (node['connect']['node'], id)
if not (connect_to in node_ips):
logs_on_error(nodes, prefix)
cleanup_tmp_dirs(temp_dirs)
print('Node not found for node: %s' % connect_to)
raise Exception('Netsim run failed')
ip = node_ips[connect_to]
cmd = cmd % ip
if node['connect']['strategy'] == 'plain_with_id':
cnt = node_counts[node['connect']['node']]
id = i % cnt
connect_to = '%s_%d' % (node['connect']['node'], id)
if not (connect_to in node_ips):
logs_on_error(nodes, prefix)
cleanup_tmp_dirs(temp_dirs)
print('Node not found for node: %s' % connect_to)
raise Exception('Netsim run failed')
ip = node_ips[connect_to]
cmd = cmd % (ip, id)
if node['connect']['strategy'] == 'params':
cnt = node_counts[node['connect']['node']]
id = i % cnt
connect_to = '%s_%d' % (node['connect']['node'], id)
if not (connect_to in node_params):
logs_on_error(nodes, prefix)
cleanup_tmp_dirs(temp_dirs)
print('Node not found for node: %s' % connect_to)
raise Exception('Netsim run failed')
param = node_params[connect_to]
cmd = cmd % (param)
# cleanup_run = subprocess.run("sudo rm -rf /root/.local/share/iroh", shell=True, capture_output=True)
Expand Down

0 comments on commit 5e894e0

Please sign in to comment.