changeset 571:53a2664f450a

build/import update for reasoning service Ignore-this: 5e2a8d717e7273bf4a84dd467cccab17
author drewp@bigasterisk.com
date Mon, 06 May 2019 00:05:24 -0700
parents f424dd6d221f
children 2395f7539ebe
files service/reasoning/Dockerfile service/reasoning/input/startup.n3 service/reasoning/inputgraph.py service/reasoning/makefile service/reasoning/reasoning.py service/reasoning/requirements.txt service/reasoning/tasks.py
diffstat 7 files changed, 67 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/service/reasoning/Dockerfile	Mon May 06 00:03:35 2019 -0700
+++ b/service/reasoning/Dockerfile	Mon May 06 00:05:24 2019 -0700
@@ -3,9 +3,8 @@
 WORKDIR /opt
 
 COPY requirements.txt ./
-RUN pip install -r requirements.txt
+RUN pip install --index-url https://projects.bigasterisk.com/ --extra-index-url https://pypi.org/simple -r requirements.txt
 
-COPY twisted_sse_demo ./twisted_sse_demo
 COPY *.n3 *.py *.html req* ./
 COPY input ./input
 
--- a/service/reasoning/input/startup.n3	Mon May 06 00:03:35 2019 -0700
+++ b/service/reasoning/input/startup.n3	Mon May 06 00:05:24 2019 -0700
@@ -1,5 +1,6 @@
 @prefix : <http://projects.bigasterisk.com/room/> .
 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix fr: <http://bigasterisk.com/foaf/> .
 
 # Note that turning off a source in here doesn't stop incoming oneshot
 # requests (but it could, if we got continuous graphs such that
@@ -48,5 +49,35 @@
 
 <http://bigasterisk.com/rfidCard/9327861a28> :cardText "UVOLLTJJEDBZTYBRPCRSFHJMEJGOQAIG"; :owner <http://bigasterisk.com/foaf.rdf#drewp> .
 <http://bigasterisk.com/rfidCard/93a7591a77> :cardText "XXGDUPSVAVJJLMZD" ;                :owner <http://bigasterisk.com/foaf.rdf#drewp> .
-<http://bigasterisk.com/rfidCard/93cd401a04> :cardText "JMQHDQZXENVZRYXUGQPYZCPJFJKIZWAS"; :owner <http://bigasterisk.com/foaf.rdf#drewp> .
+<http://bigasterisk.com/rfidCard/93cd401a04> :cardText "JMQHDQZXENVZRYXUGQPYZCPJFJKIZWAS"; :owner <http://bigasterisk.com/foaf.rdf#drewp>, :mj .
 <http://bigasterisk.com/rfidCard/a3aa6b1a78> :cardText "UOHQPTMTGSHLETGLYOMPMNJXDYINHHIF"; :owner <http://bigasterisk.com/foaf.rdf#drewp> .
+
+<http://bigasterisk.com/rfidCard/f6b85bfa> :cardText "1*LBKBQDYKFAZRHM"; rdfs:label "gray keychain id 10"; :owner <http://bigasterisk.com/foaf.rdf#drewp> .
+<http://bigasterisk.com/rfidCard/16f8dff8> :cardText "1*BHJWCUGQWPWSKT"; rdfs:label "gray keychain id 11"; :owner <http://bigasterisk.com/foaf.rdf#drewp> .
+<http://bigasterisk.com/rfidCard/46cb33fa> :cardText "1*HDMYMUHHTVGLKY"; rdfs:label "gray keychain id 12"; :owner <http://bigasterisk.com/foaf.rdf#drewp>, :kelsi .
+<http://bigasterisk.com/rfidCard/46e2dcf8> :cardText "1*NUIRKGJCOZHFOH"; rdfs:label "gray keychain id 13"; :owner <http://bigasterisk.com/foaf.rdf#drewp> .
+<http://bigasterisk.com/rfidCard/6619e5f8> :cardText "1*RMTMEEXYVIHRUM"; rdfs:label "gray keychain id 14"; :owner <http://bigasterisk.com/foaf.rdf#drewp>, :dv .
+
+<http://bigasterisk.com/rfidCard/e7654b26> :cardText "1*TXRXJXBZPXSKGZ"; rdfs:label "blue keychain id 20" .
+<http://bigasterisk.com/rfidCard/89fbaf2b> :cardText "1*IKLSYRIVCNFTTM"; rdfs:label "blue keychain id 21" .
+<http://bigasterisk.com/rfidCard/a3aa6b1a> :cardText "1*WAGLJFYAYDJCNE"; rdfs:label "white card id 22" .
+<http://bigasterisk.com/rfidCard/93a7591a> :cardText "1*WTKUGJOQXUNGUS"; rdfs:label "white card id 23" .
+<http://bigasterisk.com/rfidCard/9327861a> :cardText "1*WFMZKVPQIZIMCF"; rdfs:label "white card id 24" .
+<http://bigasterisk.com/rfidCard/5732ea1b> :cardText "1*BPNHEXJJCWQSFJ"; rdfs:label "white card id 25" .
+<http://bigasterisk.com/rfidCard/d678781a> :cardText "1*ECDFYGDLKZEGLD"; rdfs:label "white card id 26" .
+<http://bigasterisk.com/rfidCard/5bb4ed29> :cardText "1*UEFBUDDVFRFSUU"; rdfs:label "white card id 27" .
+<http://bigasterisk.com/rfidCard/560b62fa> :cardText "1*WKAPIEMNHOHMOK"; rdfs:label "gray keychain id 28" .
+<http://bigasterisk.com/rfidCard/96b1dcf8> :cardText "1*ZNBUEMOFPSIURI"; rdfs:label "gray keychain id 29" .
+<http://bigasterisk.com/rfidCard/c6f864fa> :cardText "1*PYJEJIBSETLHXW"; rdfs:label "gray keychain id 30" .
+<http://bigasterisk.com/rfidCard/5969e420> :cardText "1*ZXHYTKKWMCMDKV"; rdfs:label "blue keychain id 31" .
+<http://bigasterisk.com/rfidCard/c9f6f720> :cardText "1*QIPGMRPVRPZAQJ"; rdfs:label "blue keychain id 32" .
+<http://bigasterisk.com/rfidCard/67234b26> :cardText "1*CZGXULDJLHFJCB"; rdfs:label "blue keychain id 33" .
+<http://bigasterisk.com/rfidCard/49d30321> :cardText "1*RIHIHTWVIEZPZP"; rdfs:label "blue keychain id 34" .
+<http://bigasterisk.com/rfidCard/77f34626> :cardText "1*BKWNUZNWNWKBLY"; rdfs:label "blue keychain id 35"; :owner fr:ada .
+
+
+
+
+
+
+
--- a/service/reasoning/inputgraph.py	Mon May 06 00:03:35 2019 -0700
+++ b/service/reasoning/inputgraph.py	Mon May 06 00:05:24 2019 -0700
@@ -11,9 +11,8 @@
 from graphop import graphEqual
 from greplin import scales
 
-from patchsource import ReconnectingPatchSource
+from patchablegraph.patchsource import ReconnectingPatchSource
 
-sys.path.append("/my/proj/rdfdb")
 from rdfdb.rdflibpatch import patchQuads
 
 log = logging.getLogger('fetch')
--- a/service/reasoning/makefile	Mon May 06 00:03:35 2019 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-JOB=reasoning
-PORT=9071
-
-TAG=bang6:5000/${JOB}_x86:latest
-
-build_image:
-	rm -rf tmp_ctx
-	mkdir -p tmp_ctx
-	cp -a Dockerfile ../../lib/*.py ../../lib/twisted_sse_demo *.py *.n3 *.html input req* tmp_ctx
-	rsync -a input tmp_ctx/
-	docker build --network=host -t ${TAG} tmp_ctx
-	docker push ${TAG}
-	rm -r tmp_ctx
-
-shell:
-	docker run --rm -it --cap-add SYS_PTRACE --net=host ${TAG}  /bin/bash
-
-local_run: build_image
-	docker run --rm -it -p ${PORT}:${PORT} \
-          -v `pwd`:/mnt \
-          --net=host \
-          ${TAG} \
-          python /mnt/${JOB}.py -iro
-
-redeploy: build_image
-	supervisorctl restart $(JOB)_$(PORT)
-
--- a/service/reasoning/reasoning.py	Mon May 06 00:03:35 2019 -0700
+++ b/service/reasoning/reasoning.py	Mon May 06 00:05:24 2019 -0700
@@ -36,7 +36,7 @@
 from inputgraph import InputGraph
 from escapeoutputstatements import unquoteOutputStatements
 
-from logsetup import log
+from standardservice.logsetup import log
 
 
 ROOM = Namespace("http://projects.bigasterisk.com/room/")
--- a/service/reasoning/requirements.txt	Mon May 06 00:03:35 2019 -0700
+++ b/service/reasoning/requirements.txt	Mon May 06 00:05:24 2019 -0700
@@ -10,4 +10,9 @@
 rdflib_jsonld==0.4.0
 git+http://github.com/drewp/FuXi.git@003fb48984e9813808a23ba152798c125718f0e7#egg=FuXi
 git+http://github.com/drewp/scales.git@448d59fb491b7631877528e7695a93553bfaaa93#egg=scales
-https://projects.bigasterisk.com/rdfdb/rdfdb-0.7.0.tar.gz
+
+cycloneerr
+export_to_influxdb==0.1.0
+patchablegraph==0.6.0
+rdfdb==0.8.0
+standardservice==0.4.0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/service/reasoning/tasks.py	Mon May 06 00:05:24 2019 -0700
@@ -0,0 +1,26 @@
+from invoke import task
+
+JOB='reasoning'
+PORT=9071
+
+TAG=f'bang6:5000/{JOB}_x86:latest'
+
+@task
+def build_image(ctx):
+    ctx.run(f'docker build --network=host -t {TAG} .')
+
+@task(pre=[build_image])
+def push_image(ctx):
+    ctx.run(f'docker push {TAG}')
+
+@task
+def shell(ctx):
+    ctx.run(f'docker run --rm -it --cap-add SYS_PTRACE --net=host {TAG}  /bin/bash')
+
+@task(pre=[build_image])
+def local_run(ctx):
+    ctx.run(f'docker run --rm -it -p {PORT}:{PORT} -v `pwd`:/mnt --net=host {TAG} python /mnt/{JOB}.py -iro', pty=True)
+
+@task(pre=[build_image])
+def redeploy(ctx): 
+    ctx.run(f'supervisorctl -s http://bang:9001/ restart {JOB}_{PORT}')