changeset 1398:53d7168bbe4c

standardize build. fix /state report Ignore-this: 5a9bc82de9f0d7398c9290fc2c7ecbf9 darcs-hash:76d1c973c00084e248d881159ee90a3ae4dee655
author drewp <drewp@bigasterisk.com>
date Sat, 06 Jul 2019 13:56:07 -0700
parents 7f3eba4cfc22
children 5e8f1fcfbc79
files service/collector/Dockerfile service/collector/makefile service/collector/requirements.txt service/collector/sse_collector.py
diffstat 4 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/service/collector/Dockerfile	Sat Jul 06 13:55:59 2019 -0700
+++ b/service/collector/Dockerfile	Sat Jul 06 13:56:07 2019 -0700
@@ -5,13 +5,11 @@
 RUN apt-get install -y vim
 
 COPY requirements.txt ./
-RUN pip3 install -Ur requirements.txt
+RUN pip3 install --index-url https://projects.bigasterisk.com/ --extra-index-url https://pypi.org/simple -Ur requirements.txt
 # not sure why this doesn't work from inside requirements.txt
-RUN pip3 install -U 'https://github.com/drewp/cyclone/archive/python3.zip'
-RUN touch /usr/local/lib/python3.6/dist-packages/greplin/__init__.py
+RUN pip3 install --index-url https://projects.bigasterisk.com/ --extra-index-url https://pypi.org/simple -U 'https://github.com/drewp/cyclone/archive/python3.zip'
 
 COPY stubs ./stubs
-COPY twisted_sse_demo ./twisted_sse_demo
 COPY *.py req* *.ini ./
 
 EXPOSE 9072
--- a/service/collector/makefile	Sat Jul 06 13:55:59 2019 -0700
+++ b/service/collector/makefile	Sat Jul 06 13:56:07 2019 -0700
@@ -6,7 +6,7 @@
 build_image:
 	rm -rf tmp_ctx
 	mkdir -p tmp_ctx
-	cp -a Dockerfile ../../lib/*.py ../../lib/twisted_sse_demo *.py req* *.ini stubs tmp_ctx
+	cp -a Dockerfile *.py req* *.ini ../../stubs tmp_ctx
 	docker build --network=host -t ${TAG} tmp_ctx
 
 push_image: build_image
--- a/service/collector/requirements.txt	Sat Jul 06 13:55:59 2019 -0700
+++ b/service/collector/requirements.txt	Sat Jul 06 13:56:07 2019 -0700
@@ -9,6 +9,10 @@
 rdflib-jsonld==0.4.0
 
 git+http://github.com/drewp/scales.git@448d59fb491b7631877528e7695a93553bfaaa93#egg=scales
-https://projects.bigasterisk.com/rdfdb/rdfdb-0.8.0.tar.gz
 https://github.com/drewp/cyclone/archive/python3.zip
 influxdb==5.2.2
+
+cycloneerr
+patchablegraph==0.7.0
+rdfdb==0.8.0
+standardservice==0.4.0
--- a/service/collector/sse_collector.py	Sat Jul 06 13:55:59 2019 -0700
+++ b/service/collector/sse_collector.py	Sat Jul 06 13:56:07 2019 -0700
@@ -25,13 +25,11 @@
 import cyclone.web, cyclone.sse
 import logging, collections, json, time
 
-from logsetup import log, enableTwistedLog
+from standardservice.logsetup import log, enableTwistedLog
 from patchablegraph import jsonFromPatch
 from rdfdb.patch import Patch
 
-# workaround for broken import in twisted_sse_demo/eventsourcee.py
-import sys; sys.path.append('twisted_sse_demo')
-from patchsource import ReconnectingPatchSource
+from patchablegraph.patchsource import ReconnectingPatchSource
 
 from sse_collector_config import config
 
@@ -417,12 +415,12 @@
     def get(self) -> None:
         try:
             state = self.settings.graphClients.state()
-        except:
+            self.write(json.dumps({'graphClients': state}, indent=2,
+                                  default=lambda obj: '<unserializable>'))
+        except Exception:
             import traceback; traceback.print_exc()
             raise
         
-        self.write(json.dumps({'graphClients': state}, indent=2))
-
         
 class Root(cyclone.web.RequestHandler):
     def get(self) -> None: