# HG changeset patch # User drewp@bigasterisk.com # Date 2015-06-14 18:37:42 # Node ID 66cd0340bd32a6f55887d73ee2e1bf9917f00d9a # Parent b57e09e4fe1ce3dd9f419002970f60f90355bd80 heavy logging Ignore-this: 4241e92c17ba994503deb9aae7586d diff --git a/light9/rdfdb/autodepgraphapi.py b/light9/rdfdb/autodepgraphapi.py --- a/light9/rdfdb/autodepgraphapi.py +++ b/light9/rdfdb/autodepgraphapi.py @@ -1,7 +1,7 @@ import logging from rdflib import RDF, RDFS from light9.rdfdb.currentstategraphapi import contextsForStatementNoWildcards -log = logging.getLogger('syncedgraph') +log = logging.getLogger('autodepgraphapi') class AutoDepGraphApi(object): """ @@ -43,10 +43,12 @@ class AutoDepGraphApi(object): # it gives the same result, I don't call the handler? self.currentFuncs.append(func) + log.debug('graph.currentFuncs push %s', func) try: func() finally: self.currentFuncs.pop() + log.debug('graph.currentFuncs pop %s. stack now has %s', func, len(self.currentFuncs)) def runDepsOnNewPatch(self, p): """ @@ -55,6 +57,7 @@ class AutoDepGraphApi(object): """ for func in self._watchers.whoCares(p): # todo: forget the old handlers for this func + log.debug('runDepsOnNewPatch calling watcher %s', p) self.addHandler(func) def _getCurrentFunc(self): diff --git a/light9/rdfdb/syncedgraph.py b/light9/rdfdb/syncedgraph.py --- a/light9/rdfdb/syncedgraph.py +++ b/light9/rdfdb/syncedgraph.py @@ -82,6 +82,7 @@ class SyncedGraph(CurrentStateGraphApi, should just fail them. There should be a notification back to UIs who want to show that we're doing a resync. """ + log.info('resync') self._sender.cancelAll() # this should be locked so only one resync goes on at once return cyclone.httpclient.fetch( @@ -107,15 +108,24 @@ class SyncedGraph(CurrentStateGraphApi, # these could fail if we're out of sync. One approach: # Rerequest the full state from the server, try the patch # again after that, then give up. - log.debug("apply local patch %s", p) + debugKey = '[id=%s]' % (id(p) % 1000) + print '' + log.debug("apply local patch %s %s", debugKey, p) + import traceback; traceback.print_stack() try: - patchQuads(self._graph, p.delQuads, p.addQuads, perfect=True) + patchQuads(self._graph, + deleteQuads=p.delQuads, + addQuads=p.addQuads, + perfect=True) except ValueError as e: log.error(e) self.sendFailed(None) return + log.debug('runDepsOnNewPatch') self.runDepsOnNewPatch(p) + log.debug('sendPatch') self._sender.sendPatch(p).addErrback(self.sendFailed) + log.debug('patch is done %s', debugKey) def sendFailed(self, result): """ @@ -133,6 +143,7 @@ class SyncedGraph(CurrentStateGraphApi, """ central server has sent us a patch """ + log.debug('_onPatch server has sent us %s', p) patchQuads(self._graph, p.delQuads, p.addQuads, perfect=True) log.debug("graph now has %s statements" % len(self._graph)) try: