Mercurial > code > home > repos > homeauto
changeset 1117:d5687ba23279
fix input graph web display by dirtying combinedGraph better.
Ignore-this: e40e7499e3d675b029f829a1f269b83a
darcs-hash:c15a1820ca7b5e40b2a27946bfe1c87cc80612fa
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Sun, 09 Oct 2016 13:57:50 -0700 |
parents | d22c0c502ff6 |
children | ae6b5604950d |
files | service/reasoning/inputgraph.py service/reasoning/patchsource.py |
diffstat | 2 files changed, 11 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/service/reasoning/inputgraph.py Fri Sep 16 01:28:48 2016 -0700 +++ b/service/reasoning/inputgraph.py Sun Oct 09 13:57:50 2016 -0700 @@ -91,12 +91,16 @@ anywhere; it needs to be processed only once """ self.inputDirs = inputDirs - self.onChange = onChange + self._onChange = onChange self._fileGraph = Graph() - self._remoteData = RemoteData(lambda: self.onChange(self)) + self._remoteData = RemoteData(lambda: self.onChangeLocal()) self._combinedGraph = None self._oneShotAdditionGraph = None + def onChangeLocal(self, oneShot=False, oneShotGraph=None): + self._combinedGraph = None + self._onChange(self, oneShot=oneShot, oneShotGraph=oneShotGraph) + def updateFileData(self): """ make sure we contain the correct data from the files in inputDirs @@ -115,7 +119,7 @@ self._fileGraph.parse(fp.open(), format="n3") self._combinedGraph = None - self.onChange(self) + self.onChangeLocal() def addOneShot(self, g): """
--- a/service/reasoning/patchsource.py Fri Sep 16 01:28:48 2016 -0700 +++ b/service/reasoning/patchsource.py Sun Oct 09 13:57:50 2016 -0700 @@ -1,4 +1,4 @@ -import sys +import sys, logging import traceback from twisted.internet import reactor, defer from twisted_sse_demo.eventsource import EventSource @@ -6,12 +6,12 @@ from rdflib.parser import StringInputSource sys.path.append("../../lib") -from logsetup import log from patchablegraph import patchFromJson sys.path.append("/my/proj/light9") from light9.rdfdb.patch import Patch +log = logging.getLogger('fetch') class PatchSource(object): """wrap EventSource so it emits Patch objects and has an explicit stop method.""" @@ -25,6 +25,8 @@ self._listeners = set() log.info('start read from %s', url) + # note: fullGraphReceived isn't guaranteed- the stream could + # start with patches self._fullGraphReceived = False self._eventSource = EventSource(url.toPython().encode('utf8')) self._eventSource.protocol.delimiter = '\n'