from monitor import config
from monitor.wrapper import plc,plccache
from monitor.const import MINUP
-from monitor.database import FindbadNodeRecord, HistoryNodeRecord
+from monitor.database.info.model import FindbadNodeRecord, HistoryNodeRecord
+from monitor.database.dborm import mon_session as session
from monitor.model import *
print traceback.print_exc()
continue
+ if not noderec:
+ print "none object for %s"% nodename
+ continue
+
node_state = noderec.observed_status
if noderec.plc_node_stats:
boot_state = noderec.plc_node_stats['boot_state']
# replace with another operations that also commits all pending ops, such
# as session.commit() or flush() or something
print HistoryNodeRecord.query.count()
+ session.flush()
return True