X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=pcubad.py;h=181f001ee3d9838368bc8d14a6ae79c95c949de7;hb=38d434f7f399272701bf0d85fcb0f82ae3b44733;hp=1fd337159defff8370fd25d1348c66b3a16066a9;hpb=19414270cf2c8429daab02fdebbd8081d9ba0db0;p=monitor.git diff --git a/pcubad.py b/pcubad.py index 1fd3371..181f001 100755 --- a/pcubad.py +++ b/pcubad.py @@ -7,23 +7,23 @@ import time from datetime import datetime,timedelta from monitor import database -from monitor.pcu import reboot +from pcucontrol import reboot from monitor import parser as parsermodule from monitor import config -from monitor.database import HistoryPCURecord, FindbadPCURecord -from monitor.wrapper import plc +from monitor.database.info.model import HistoryPCURecord, FindbadPCURecord +from monitor.database.dborm import mon_session as session +from monitor.wrapper import plc,plccache from monitor.const import MINUP -from nodecommon import * +from monitor.common import * from nodequery import verify,query_to_dict,node_select -import syncplcdb -from unified_model import * +from monitor.model import * api = plc.getAuthAPI() def main(config): - l_plcpcus = database.if_cached_else_refresh(1, 1, "pculist", lambda : plc.GetPCUs()) + l_plcpcus = plccache.l_pcus l_pcus = None if config.pcu: @@ -39,7 +39,7 @@ def main(config): checkAndRecordState(l_pcus, l_plcpcus) -hn2lb = database.dbLoad("plcdb_hn2lb") +hn2lb = plccache.plcdb_hn2lb def checkAndRecordState(l_pcus, l_plcpcus): count = 0 @@ -94,6 +94,7 @@ def checkAndRecordState(l_pcus, l_plcpcus): # replace with another operations that also commits all pending ops, such # as session.commit() or flush() or something print HistoryPCURecord.query.count() + session.flush() return True