summaryrefslogtreecommitdiffstats
path: root/retiolum/scripts/adv_graphgen/parse_tinc_stats.py
diff options
context:
space:
mode:
authormakefu <root@pigstarter.de>2013-01-24 02:24:16 +0000
committermakefu <root@pigstarter.de>2013-01-24 02:24:16 +0000
commit55d7d06d41fc47d32e4c138cb5aa7127cfd4864b (patch)
tree682381546d62027a4a066285f39c1ddc3a6a4997 /retiolum/scripts/adv_graphgen/parse_tinc_stats.py
parentc939be138f8c51766032c91c11558e5a79fa15c5 (diff)
fix misleading function name in find_super
Diffstat (limited to 'retiolum/scripts/adv_graphgen/parse_tinc_stats.py')
-rwxr-xr-xretiolum/scripts/adv_graphgen/parse_tinc_stats.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py
index 76a3ffcd..e5bd96a8 100755
--- a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py
+++ b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py
@@ -2,7 +2,7 @@
# -*- coding: utf8 -*-
from BackwardsReader import BackwardsReader
import sys,json
-from find_super import check_super
+from find_super import check_all_the_super
try:
from time import time
import socket
@@ -18,7 +18,7 @@ except Exception as e:
sys.stderr.write("Cannot connect to graphite: %s\n" % str(e))
supernodes= [ ]
-for supernode,addr in check_super():
+for supernode,addr in check_all_the_super():
supernodes.append(supernode)
""" TODO: Refactoring needed to pull the edges out of the node structures again,
it should be easier to handle both structures"""
@@ -39,6 +39,7 @@ def write_digraph(nodes):
for k,v in nodes.iteritems():
write_node(k,v)
print ('}')
+
def dump_graph(nodes):
from time import time
graph = {}
@@ -48,6 +49,7 @@ def dump_graph(nodes):
json.dump(graph,f)
f.write('\n')
f.close()
+
def write_stat_node(nodes):
''' Write a `stats` node in the corner
This node contains infos about the current number of active nodes and connections inside the network
@@ -95,6 +97,7 @@ def generate_stats(nodes):
v['avg_weight'] = get_node_avg_weight(conns)
v['availability'] = get_node_availability(k,jlines)
sys.stderr.write( "%s -> %f\n" %(k ,v['availability']))
+
def get_node_avg_weight(conns):
""" calculates the average weight for the given connections """
if not conns:
@@ -143,6 +146,7 @@ def delete_unused_nodes(nodes):
#del(new_nodes[k])
del(k)
return new_nodes
+
def merge_edges(nodes):
""" merge back and forth edges into one
DESTRUCTS the current structure by deleting "connections" in the nodes