Mercurial > code > home > repos > light9
changeset 1281:66cd0340bd32
heavy logging
Ignore-this: 4241e92c17ba994503deb9aae7586d
author | drewp@bigasterisk.com |
---|---|
date | Sun, 14 Jun 2015 18:37:42 +0000 |
parents | b57e09e4fe1c |
children | 2c0c3aec0d63 |
files | light9/rdfdb/autodepgraphapi.py light9/rdfdb/syncedgraph.py |
diffstat | 2 files changed, 17 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/light9/rdfdb/autodepgraphapi.py Sun Jun 14 17:30:00 2015 +0000 +++ b/light9/rdfdb/autodepgraphapi.py Sun Jun 14 18:37:42 2015 +0000 @@ -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 @@ # 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 @@ """ 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):
--- a/light9/rdfdb/syncedgraph.py Sun Jun 14 17:30:00 2015 +0000 +++ b/light9/rdfdb/syncedgraph.py Sun Jun 14 18:37:42 2015 +0000 @@ -82,6 +82,7 @@ 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 @@ # 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 @@ """ 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: