Mercurial > code > home > repos > homeauto
comparison service/piNode/piNode.py @ 1269:73b6ed12bae6
stats handler, events output fix, build updaets
Ignore-this: 3f2d695e0e49e8be8084017de08b0539
darcs-hash:d6243c6c3484793b4e1c0e7ce359d551dad4cd07
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Sat, 20 Apr 2019 23:40:29 -0700 |
parents | 8512001ae0a1 |
children | 98384c3ccd33 |
comparison
equal
deleted
inserted
replaced
1268:42f333f7d088 | 1269:73b6ed12bae6 |
---|---|
6 from rdflib.parser import StringInputSource | 6 from rdflib.parser import StringInputSource |
7 from twisted.internet import reactor, task | 7 from twisted.internet import reactor, task |
8 from twisted.internet.threads import deferToThread | 8 from twisted.internet.threads import deferToThread |
9 from docopt import docopt | 9 from docopt import docopt |
10 import etcd3 | 10 import etcd3 |
11 from greplin import scales | |
12 from greplin.scales.cyclonehandler import StatsHandler | |
11 | 13 |
12 logging.basicConfig(level=logging.DEBUG) | 14 logging.basicConfig(level=logging.DEBUG) |
13 | 15 |
14 sys.path.append("../../lib") | 16 sys.path.append("../../lib") |
15 from patchablegraph import PatchableGraph, CycloneGraphHandler, CycloneGraphEventsHandler | 17 from patchablegraph import PatchableGraph, CycloneGraphHandler, CycloneGraphEventsHandler |
35 HOST = Namespace('http://bigasterisk.com/ruler/host/') | 37 HOST = Namespace('http://bigasterisk.com/ruler/host/') |
36 | 38 |
37 hostname = socket.gethostname() | 39 hostname = socket.gethostname() |
38 CTX = ROOM['pi/%s' % hostname] | 40 CTX = ROOM['pi/%s' % hostname] |
39 | 41 |
42 STATS = scales.collection('/root', | |
43 ) | |
40 def patchRandid(): | 44 def patchRandid(): |
41 """ | 45 """ |
42 I'm concerned urandom is slow on raspberry pi, and I'm adding to | 46 I'm concerned urandom is slow on raspberry pi, and I'm adding to |
43 graphs a lot. Unclear what the ordered return values might do to | 47 graphs a lot. Unclear what the ordered return values might do to |
44 the balancing of the graph. | 48 the balancing of the graph. |
304 | 308 |
305 reactor.listenTCP(9059, cyclone.web.Application([ | 309 reactor.listenTCP(9059, cyclone.web.Application([ |
306 (r"/()", cyclone.web.StaticFileHandler, { | 310 (r"/()", cyclone.web.StaticFileHandler, { |
307 "path": "static", "default_filename": "index.html"}), | 311 "path": "static", "default_filename": "index.html"}), |
308 (r'/static/(.*)', cyclone.web.StaticFileHandler, {"path": "static"}), | 312 (r'/static/(.*)', cyclone.web.StaticFileHandler, {"path": "static"}), |
313 (r'/stats/(.*)', StatsHandler, {'serverName': 'piNode'}), | |
309 (r'/boards', Boards), | 314 (r'/boards', Boards), |
310 (r"/graph", CycloneGraphHandler, {'masterGraph': masterGraph}), | 315 (r"/graph", CycloneGraphHandler, {'masterGraph': masterGraph}), |
311 (r"/graph/events", CycloneGraphEventsHandler, {'masterGraph': masterGraph}), | 316 (r"/graph/events", CycloneGraphEventsHandler, {'masterGraph': masterGraph}), |
312 (r'/output', OutputPage), | 317 (r'/output', OutputPage), |
313 (r'/dot', Dot), | 318 (r'/dot', Dot), |
314 ], config=config, debug=arg['-v']), interface='::') | 319 ], config=config, debug=arg['-v']), interface='::') |
315 log.warn('serving on 9059') | 320 log.warn('serving on 9059') |
316 reactor.run() | 321 reactor.run() |
317 | 322 |
318 main() | 323 main() |