Commit 3d7826bc authored by Antoine Kaufmann's avatar Antoine Kaufmann Committed by Hejing Li
Browse files

experiments: e2e partitioner now also returns dot rendering, e2e_bgsplit experiment saves it

parent 6b37db23
...@@ -59,7 +59,7 @@ for N in splits: ...@@ -59,7 +59,7 @@ for N in splits:
add_contig_bg(topology) add_contig_bg(topology)
# Partition into N ns-3 processes # Partition into N ns-3 processes
nets = e2e_part.partition(topology, N) nets, dot = e2e_part.partition(topology, N)
for net in nets: for net in nets:
net.e2e_global.stop_time = '1s' net.e2e_global.stop_time = '1s'
net.opt = ' '.join([f'--{o[0]}={o[1]}' for o in options.items()]) net.opt = ' '.join([f'--{o[0]}={o[1]}' for o in options.items()])
...@@ -67,4 +67,7 @@ for N in splits: ...@@ -67,4 +67,7 @@ for N in splits:
e.add_network(net) e.add_network(net)
net.init_network() net.init_network()
with open(f'out/{e.name}.dot', 'w') as f:
f.write(dot)
experiments.append(e) experiments.append(e)
...@@ -94,16 +94,17 @@ def partition(topology, N): ...@@ -94,16 +94,17 @@ def partition(topology, N):
node_partitions[p].append(i) node_partitions[p].append(i)
# For debugging: print out dot representation of partition # For debugging: print out dot representation of partition
#print('graph R {') dot = 'graph R {\n'
#for p in sorted(node_partitions.keys()): for p in sorted(node_partitions.keys()):
# print(f'subgraph cluster{p} {{') dot += f'subgraph cluster{p} {{\n'
# for n_i in node_partitions[p]: dot += f'label = "netpart_{p}";\n'
# n = idmap.from_id(n_i) for n_i in node_partitions[p]:
# print(f'n{n_i} [label="{n.id}"];') n = idmap.from_id(n_i)
# print('}') dot += f'n{n_i} [label="{n.id}"];\n'
#for (s,d) in edges: dot += '}\n'
# print(f'n{s} -- n{d};') for (s,d) in edges:
#print('}') dot += f'n{s} -- n{d};\n'
dot += '}'
# create the networks # create the networks
...@@ -158,4 +159,4 @@ def partition(topology, N): ...@@ -158,4 +159,4 @@ def partition(topology, N):
con_a.set_peer(lst_a) con_a.set_peer(lst_a)
con.add_component(con_a) con.add_component(con_a)
return networks return (networks, dot)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment