Mercurial > code > home > repos > homeauto
changeset 923:4ae49c6adecb
errors and logging in reasoning
Ignore-this: 112b2985e0f5fd2a36abded52a5292b6
darcs-hash:20130922073139-312f9-4bb490330fe3e64b3ee87176e7eb2385255c4c72
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Sun, 22 Sep 2013 00:31:39 -0700 |
parents | e4069a2cfcc8 |
children | 4620a5d2f337 |
files | service/reasoning/graphop.py service/reasoning/rdflibtrig.py service/reasoning/reasoning.py service/reasoning/rules.n3 |
diffstat | 4 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/service/reasoning/graphop.py Sun Sep 22 00:30:20 2013 -0700 +++ b/service/reasoning/graphop.py Sun Sep 22 00:31:39 2013 -0700 @@ -30,12 +30,12 @@ if log.getEffectiveLevel() <= logging.INFO: lost = stmtsA - stmtsB if lost: - log.info("lost statements:") + log.info("graph A only:") for s in lost: log.info(" %s", s) new = stmtsB - stmtsA if new: - log.info("new statements:") + log.info("graph B only:") for s in new: log.info(" %s", s) return False
--- a/service/reasoning/rdflibtrig.py Sun Sep 22 00:30:20 2013 -0700 +++ b/service/reasoning/rdflibtrig.py Sun Sep 22 00:31:39 2013 -0700 @@ -26,7 +26,10 @@ def addTrig(graph, url): t1 = time.time() - trig = restkit.request(url).body_string() + response = restkit.request(url) + if response.status_int != 200: + raise ValueError("status %s from %s" % (response.status, url)) + trig = response.body_string() fetchTime = time.time() - t1 graph.addN(parseTrig(trig)) return fetchTime
--- a/service/reasoning/reasoning.py Sun Sep 22 00:30:20 2013 -0700 +++ b/service/reasoning/reasoning.py Sun Sep 22 00:31:39 2013 -0700 @@ -117,6 +117,7 @@ URIRef("http://projects.bigasterisk.com/room/usingPower"), URIRef("http://projects.bigasterisk.com/room/idleTimeMinutes"), URIRef("http://projects.bigasterisk.com/room/idleTimeMs"), + ROOM.history, ])): log.debug(" remote graph changed") self.onChange(self)
--- a/service/reasoning/rules.n3 Sun Sep 22 00:30:20 2013 -0700 +++ b/service/reasoning/rules.n3 Sun Sep 22 00:31:39 2013 -0700 @@ -28,7 +28,7 @@ { :auth :near :home . - dev:theaterDoorOutsideMotion :state :motion. + dev:theaterDoorOutsideMotion :state :sustainedMotion . dev:theaterDoorOpen :state :closed . env: :localHour :awakeTime . } => { dev:theaterDoorLock :state :unlocked } .