changeset 2078:2c48e92ad5d3

make loadtest real enough to cause numbers to change on collector's web view
author drewp@bigasterisk.com
date Tue, 24 May 2022 01:21:32 -0700
parents 46a8f5a8a4dd
children 5ea209b111fe
files bin/collector_loadtest.py light9/collector/output.py
diffstat 2 files changed, 15 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/bin/collector_loadtest.py	Tue May 24 01:00:40 2022 -0700
+++ b/bin/collector_loadtest.py	Tue May 24 01:21:32 2022 -0700
@@ -1,8 +1,9 @@
 #!bin/python
 import asyncio
 import logging
+import random
+from rdflib import URIRef
 import time
-from typing import cast
 
 from light9.collector.collector_client_asyncio import sendToCollector
 from light9.effect.settings import DeviceSettings
@@ -15,7 +16,7 @@
 async def loadTest():
     print("scheduling loadtest")
     n = 200000
-    period=1
+    period=.02
     times = []
     session = "loadtest%s" % time.time()
     for i in range(n):
@@ -28,15 +29,15 @@
             DeviceSettings(
                 graph=None,
                 settingsList=[
-                    [DEV["backlight1"], L9["color"], "#ffffff"],  #
-                    [DEV["backlight2"], L9["color"], "#ffffff"],
-                    [DEV["backlight3"], L9["color"], "#ffffff"],
-                    [DEV["backlight4"], L9["color"], "#ffffff"],
-                    [DEV["backlight5"], L9["color"], "#ffffff"],
-                    [DEV["down2"], L9["color"], "#ffffff"],
-                    [DEV["down3"], L9["color"], "#ffffff"],
-                    [DEV["down4"], L9["color"], "#ffffff"],
-                    [DEV["houseSide"], L9["level"], .8],
+                    # [DEV["backlight1"], L9["color"], "#ffffff"],  #
+                    # [DEV["backlight2"], L9["color"], "#ffffff"],
+                    # [DEV["backlight3"], L9["color"], "#ffffff"],
+                    # [DEV["backlight4"], L9["color"], "#ffffff"],
+                    # [DEV["backlight5"], L9["color"], "#ffffff"],
+                    # [DEV["down2"], L9["color"], "#ffffff"],
+                    # [DEV["down3"], L9["color"], "#ffffff"],
+                    # [DEV["down4"], L9["color"], "#ffffff"],
+                    [URIRef('http://light9.bigasterisk.com/theater/skyline/device/down1'), L9["brightness"], random.random()],
                     [DEV["backlight5"], L9["uv"], 0.011]
                 ]))
         times.append(time.time() - start)
--- a/light9/collector/output.py	Tue May 24 01:00:40 2022 -0700
+++ b/light9/collector/output.py	Tue May 24 01:21:32 2022 -0700
@@ -65,6 +65,9 @@
     def __init__(self, uri, **kw):
         super().__init__(uri)
 
+    def update(self, buf:bytes):
+        log.info(f'dummy update {list(map(int,buf[:80]))}')
+
 
 class BackgroundLoopOutput(Output):
     """Call _write forever at 20hz in background threads"""