[tor-commits] [depictor/master] Make the graph min/max values configurable so small networks still get graphs.

tom at torproject.org tom at torproject.org
Wed Nov 2 19:56:30 UTC 2016


commit 983d981502f751aa640fc1181911d7bdf3a31b39
Author: Tom <tom at ritter.vg>
Date:   Fri Oct 28 15:22:59 2016 -0500

    Make the graph min/max values configurable so small networks still get graphs.
---
 data/consensus.cfg | 9 ++++++++-
 graphs.py          | 6 ++++--
 website.py         | 2 ++
 write_website.py   | 4 +++-
 4 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/data/consensus.cfg b/data/consensus.cfg
index 381684a..e05818f 100644
--- a/data/consensus.cfg
+++ b/data/consensus.cfg
@@ -1,6 +1,13 @@
 # control consensus-health output
 
-ignore_fallback_authorities False
+# do not show all fallback directory output
+ignore_fallback_authorities True
+
+# do not show values less than this amount on the graph. For small testing networks set to 1
+graph_logical_min 125
+
+# do not show values values greater than this on the graph. You can leave this high
+graph_logical_max 25000
 
 # recognized tor consensus parameters
 
diff --git a/graphs.py b/graphs.py
index 6738a52..6ed4a1f 100755
--- a/graphs.py
+++ b/graphs.py
@@ -284,8 +284,8 @@ class GraphWriter(WebsiteWriter):
 
 	def _write_graph_javascript(self):
 		s = """<script>
-		var AUTH_LOGICAL_MIN = 125,
-		    AUTH_LOGICAL_MAX = 25000;
+		var AUTH_LOGICAL_MIN = """ + str(self.config['graph_logical_min']) + """,
+		    AUTH_LOGICAL_MAX = """ + str(self.config['graph_logical_max']) + """;
 		var WIDTH = 800,
 		    HEIGHT = 500,
 		    MARGIN = {top: 40, right: 40, bottom: 40, left: 40};
@@ -661,6 +661,8 @@ if __name__ == '__main__':
 	CONFIG = stem.util.conf.config_dict('consensus', {
                                     'known_params': [],
                                     'ignore_fallback_authorities': False,
+                                    'graph_logical_min': 125,
+                                    'graph_logical_max': 25000
                                     })
 	config = stem.util.conf.get_config("consensus")
 	config.load(os.path.join(os.path.dirname(__file__), 'data', 'consensus.cfg'))
diff --git a/website.py b/website.py
index 592ad0e..059fb7b 100755
--- a/website.py
+++ b/website.py
@@ -1075,6 +1075,8 @@ if __name__ == '__main__':
 	CONFIG = stem.util.conf.config_dict('consensus', {
                                     'known_params': [],
                                     'ignore_fallback_authorities': False,
+                                    'graph_logical_min': 125,
+                                    'graph_logical_max': 25000
                                     })
 	config = stem.util.conf.get_config("consensus")
 	config.load(os.path.join(os.path.dirname(__file__), 'data', 'consensus.cfg'))
diff --git a/write_website.py b/write_website.py
index 3d4760d..7803ba6 100755
--- a/write_website.py
+++ b/write_website.py
@@ -46,7 +46,9 @@ from graphs import GraphWriter
 
 CONFIG = stem.util.conf.config_dict('consensus', {
 	'known_params': [],
-	'ignore_fallback_authorities' : False
+	'ignore_fallback_authorities' : False,
+	'graph_logical_min' : 125,
+	'graph_logical_max' : 25000
 })
 
 def main():



More information about the tor-commits mailing list