Mercurial > code > home > repos > homeauto
diff service/reasoning/reasoning.py @ 392:79d041273e26
mqtt has two devices now. various older cleanups.
Ignore-this: 67ca3acc5dc6aa672d0c896c9f5ae48e
author | drewp@bigasterisk.com |
---|---|
date | Sat, 19 Jan 2019 12:08:59 -0800 |
parents | 7716b1810d6c |
children | 1ceb26846eca |
line wrap: on
line diff
--- a/service/reasoning/reasoning.py Sat Jan 19 10:44:10 2019 -0800 +++ b/service/reasoning/reasoning.py Sat Jan 19 12:08:59 2019 -0800 @@ -45,7 +45,9 @@ NS = {'': ROOM, 'dev': DEV} STATS = scales.collection('/web', - scales.PmfStat('graphChanged')) + scales.PmfStat('graphChanged'), + scales.PmfStat('updateRules'), +) class Reasoning(object): def __init__(self): @@ -59,6 +61,7 @@ self.inputGraph = InputGraph([], self.graphChanged) self.inputGraph.updateFileData() + @STATS.updateRules.time() def updateRules(self): rulesPath = 'rules.n3' try: @@ -90,7 +93,11 @@ statements are already in inputGraph.getGraph(). """ log.info("----------------------") - log.info("graphChanged (oneShot=%s):", oneShot) + log.info("graphChanged (oneShot=%s %s stmts):", + oneShot, len(oneShotGraph) if oneShotGraph is not None else 0) + if oneShotGraph: + for stmt in oneShotGraph: + log.info(" OS-> %r", stmt) t1 = time.time() oldInferred = self.inferred try: @@ -171,6 +178,7 @@ everything appears to be a 'change'. """ try: + log.info('POST to oneShot, headers=%s', self.request.headers) dt = self.settings.reasoning.inputGraph.addOneShotFromString( self.request.body, self.request.headers['content-type']) self.set_header('x-graph-ms', str(1000 * dt)) @@ -294,7 +302,6 @@ -i Verbose log on the input phase -r Verbose log on the reasoning phase and web stuff -o Verbose log on the actions/output phase - --source=<substr> Limit sources to those with this string. """) r = Reasoning()