changeset 1063:295d20307b81

try a speedup for raspi Ignore-this: 9cdbabb99c9888792c167866f06d65eb darcs-hash:a10ec9fb5dc728c876e236137bce904f1d190414
author drewp <drewp@bigasterisk.com>
date Mon, 21 Mar 2016 04:23:59 -0700
parents 6ab7a933c2a8
children d29b9212c4c5
files service/piNode/piNode.py
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/service/piNode/piNode.py	Mon Mar 21 04:22:39 2016 -0700
+++ b/service/piNode/piNode.py	Mon Mar 21 04:23:59 2016 -0700
@@ -36,6 +36,20 @@
 
 CTX = ROOM['pi/%s' % hostname]
 
+def patchRandid():
+    """
+    I'm concerned urandom is slow on raspberry pi, and I'm adding to
+    graphs a lot. Unclear what the ordered return values might do to
+    the balancing of the graph.
+    """
+    _id_serial = [1000]
+    def randid():
+        _id_serial[0] += 1
+        return _id_serial[0]
+    import rdflib.plugins.memory
+    rdflib.plugins.memory.randid = randid
+patchRandid()
+
 class Config(object):
     def __init__(self, masterGraph):
         self.graph = ConjunctiveGraph()
@@ -43,6 +57,7 @@
         for f in os.listdir('config'):
             if f.startswith('.'): continue
             self.graph.parse('config/%s' % f, format='n3')
+            log.info('  parsed %s', f)
         self.graph.bind('', ROOM) # not working
         self.graph.bind('rdf', RDF)
         # config graph is too noisy; maybe make it a separate resource
@@ -245,6 +260,7 @@
         (r'/output', OutputPage),
         (r'/dot', Dot),
         ], config=config, board=board, debug=arg['-v']), interface='::')
+    log.warn('serving on 9059')
     reactor.run()
 
 main()