changeset 1926:1a7e5b07bf17

use my greplin fork's stats/ code instead of an old local one Ignore-this: f0935bd61f0b982e544c1991e14fb51e
author Drew Perttula <drewp@bigasterisk.com>
date Sun, 02 Jun 2019 00:05:12 +0000
parents f8ab10f4c80b
children 4718ca6f812e
files bin/captureDevice bin/collector bin/effecteval bin/effectsequencer bin/paintserver light9/collector/web/index.html light9/effect/sequencer.html light9/greplin_cyclone.py light9/web/index.html
diffstat 9 files changed, 24 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
--- a/bin/captureDevice	Sat Jun 01 23:46:34 2019 +0000
+++ b/bin/captureDevice	Sun Jun 02 00:05:12 2019 +0000
@@ -19,7 +19,7 @@
 from light9 import networking, showconfig
 from rdfdb.syncedgraph import SyncedGraph
 from light9.paint.capture import writeCaptureDescription
-from light9.greplin_cyclone import StatsForCyclone
+from greplin.scales.cyclonehandler import StatsHandler
 from light9.effect.settings import DeviceSettings
 from light9.collector.collector_client import sendToCollector
 from rdfdb.patch import Patch
@@ -173,7 +173,9 @@
                               "path": "light9/web",
                               "default_filename": "captureDevice.html"
                           }),
-                          (r'/stats', StatsForCyclone),
+                          (r'/stats/(.*)', StatsHandler, {
+                              'serverName': 'captureDevice'
+                          }),
                       ]),
                       interface='::',
                       cap=cap)
--- a/bin/collector	Sat Jun 01 23:46:34 2019 +0000
+++ b/bin/collector	Sun Jun 02 00:05:12 2019 +0000
@@ -21,7 +21,7 @@
 from light9 import networking
 from light9.collector.collector import Collector
 from light9.collector.weblisteners import WebListeners
-from light9.greplin_cyclone import StatsForCyclone
+from greplin.scales.cyclonehandler import StatsHandler
 from light9.namespaces import L9
 from light9.zmqtransport import parseJsonMessage, startZmq
 from rdfdb.syncedgraph import SyncedGraph
@@ -84,7 +84,9 @@
                           }),
                           (r'/updates', Updates),
                           (r'/attrs', Attrs),
-                          (r'/stats', StatsForCyclone),
+                          (r'/stats/(.*)', StatsHandler, {
+                              'serverName': 'collector'
+                          }),
                       ],
                                               collector=c,
                                               listeners=listeners),
--- a/bin/effecteval	Sat Jun 01 23:46:34 2019 +0000
+++ b/bin/effecteval	Sun Jun 02 00:05:12 2019 +0000
@@ -13,7 +13,7 @@
 from light9.effecteval.effect import EffectNode
 from light9.effect.edit import getMusicStatus, songNotePatch
 from light9.effecteval.effectloop import makeEffectLoop
-from light9.greplin_cyclone import StatsForCyclone
+from greplin.scales.cyclonehandler import StatsHandler
 from light9.namespaces import L9
 from rdfdb.patch import Patch
 from rdfdb.syncedgraph import SyncedGraph
@@ -251,7 +251,9 @@
             (r'/effect/eval', EffectEval),
             (r'/songEffects', SongEffects),
             (r'/songEffects/eval', SongEffectsEval),
-            (r'/stats', StatsForCyclone),
+            (r'/stats/(.*)', StatsHandler, {
+                'serverName': 'effecteval'
+            }),
         ],
                                                   debug=True,
                                                   graph=self.graph,
--- a/bin/effectsequencer	Sat Jun 01 23:46:34 2019 +0000
+++ b/bin/effectsequencer	Sun Jun 02 00:05:12 2019 +0000
@@ -5,7 +5,7 @@
 
 from run_local import log
 from twisted.internet import reactor
-from light9.greplin_cyclone import StatsForCyclone
+from greplin.scales.cyclonehandler import StatsHandler
 from rdfdb.syncedgraph import SyncedGraph
 from light9 import networking, showconfig
 from greplin import scales
@@ -51,7 +51,9 @@
                 "default_filename": "sequencer.html"
             }),
             (r'/updates', Updates),
-            (r'/stats', StatsForCyclone),
+            (r'/stats/(.*)', StatsHandler, {
+                'serverName': 'effectsequencer'
+            }),
         ],
                                                   debug=True,
                                                   seq=self.seq,
--- a/bin/paintserver	Sat Jun 01 23:46:34 2019 +0000
+++ b/bin/paintserver	Sun Jun 02 00:05:12 2019 +0000
@@ -3,7 +3,7 @@
 from run_local import log
 import json
 from twisted.internet import reactor
-from light9.greplin_cyclone import StatsForCyclone
+from greplin.scales.cyclonehandler import StatsHandler
 from rdfdb.syncedgraph import SyncedGraph
 from light9 import networking, showconfig
 from greplin import scales
@@ -91,7 +91,9 @@
         self.solver.loadSamples()
 
         self.cycloneApp = cyclone.web.Application(handlers=[
-            (r'/stats', StatsForCyclone),
+            (r'/stats/(.*)', StatsHandler, {
+                'serverName': 'paintserver'
+            }),
             (r'/solve', Solve),
             (r'/bestMatches', BestMatches),
         ],
--- a/light9/collector/web/index.html	Sat Jun 01 23:46:34 2019 +0000
+++ b/light9/collector/web/index.html	Sun Jun 02 00:05:12 2019 +0000
@@ -97,7 +97,7 @@
       <template>
         <rdfdb-synced-graph graph="{{graph}}"></rdfdb-synced-graph>
 
-        <h1>Collector <a href="stats">[stats]</a></h1>
+        <h1>Collector <a href="stats/">[stats]</a></h1>
 
         <h2>Devices</h2>
         <div style="column-width: 11em">
--- a/light9/effect/sequencer.html	Sat Jun 01 23:46:34 2019 +0000
+++ b/light9/effect/sequencer.html	Sun Jun 02 00:05:12 2019 +0000
@@ -55,7 +55,7 @@
         </style>
         <rdfdb-synced-graph graph="{{graph}}"></rdfdb-synced-graph>
 
-        <h1>Sequencer <a href="stats">[stats]</a></h1>
+        <h1>Sequencer <a href="stats/">[stats]</a></h1>
 
         <p>fps={{report.recentFps}}</p>
         
--- a/light9/greplin_cyclone.py	Sat Jun 01 23:46:34 2019 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-from typing import List
-
-import cyclone.web
-
-import greplin.scales.twistedweb, greplin.scales.formats, greplin.scales.util
-from greplin import scales
-
-
-# Like scales.twistedweb.StatsResource, but modified for cyclone. May
-# be missing features.
-class StatsForCyclone(cyclone.web.RequestHandler):
-
-    def get(self):
-        parts: List[str] = []
-        statDict = greplin.scales.util.lookup(scales.getStats(), parts)
-
-        if statDict is None:
-            self.set_status(404)
-            self.write("Path not found.")
-            return
-
-        query = self.get_argument('query', default=None)
-
-        if self.get_argument('format', default=None) == 'json':
-            self.set_header('content-type', 'text/javascript; charset=UTF-8')
-            greplin.scales.formats.jsonFormat(self, statDict, query)
-        elif self.get_argument('format', default=None) == 'prettyjson':
-            self.set_header('content-type', 'text/javascript; charset=UTF-8')
-            greplin.scales.formats.jsonFormat(self,
-                                              statDict,
-                                              query,
-                                              pretty=True)
-        else:
-            greplin.scales.formats.htmlHeader(self, '/' + '/'.join(parts),
-                                              'svr', query)
-            greplin.scales.formats.htmlFormat(self, tuple(parts), statDict,
-                                              query)
--- a/light9/web/index.html	Sat Jun 01 23:46:34 2019 +0000
+++ b/light9/web/index.html	Sun Jun 02 00:05:12 2019 +0000
@@ -33,7 +33,8 @@
         <div>
           <span class="left"><a class="big" href="{{name}}/">{{name}}</a></span>
           <span class="window"><button on-click="click">window</button></span>
-          <span><a href="{{name}}/stats">stats</a></span>
+          <span><a href="{{name}}/stats/">stats</a></span>
+          <span id="stats"></span>
         </div>
       </template>
       <script>