def run(self): logging.debug("Thread_UpdateBSG: STARTING") eeker.updatingalready_lock.acquire() eeker.updatingalready = True eeker.updatingalready_lock.release() registrationsupdateflag = True supresswrite = False logging.debug( "Thread_UpdateBSG: At beginning of thread: Type of eeker.db_femtos = " + str(type(eeker.db_femtos)) ) logging.debug( "Thread_UpdateBSG: At beginning of thread: Type of eeker.db_alarmso = " + str(type(eeker.db_alarmso)) ) logging.debug( "Thread_UpdateBSG: At beginning of thread: Type of eeker.db_alarmsd = " + str(type(eeker.db_alarmsd)) ) # obtain a copy of active eeker.db_femtos logging.debug( "Thread_UpdateBSG:\t" + "before entering popLockAndDropIt, eeker.db_femtos.timeupdated_bsg = " + str(eeker.db_femtos.timeupdated_bsg) ) db_femtos_standby = popLockAndDropIt(eeker.db_femtos, eeker.dblock, "Thread_UpdateBSG__db_femtos_atos") logging.info("Thread_initDB" + "\t" + "Kicking off 'buildInv_BSG' function...") """Here we'll run the buildInv_BSG function and pass in the config class object and a few other options including the current blank inventory db""" showupdatedbool = True # kick off buildInv_BSG with showupdatedbool = True, silent = logging.debug( "Thread_UpdateBSG:\t" + "before entering buildInv_BSG, db_femtos_standby.timeupdated_bsg = " + str(db_femtos_standby.timeupdated_bsg) ) db_femtos_standby = pmLoaders.buildInv_BSG( supresswrite, registrationsupdateflag, pmConfig.fgwList, db_femtos_standby, showupdatedbool, eeker.bool_silentupdates, ) logging.debug( "Thread_UpdateBSG:\t" + "after leaving buildInv_BSG, db_femtos_standby.timeupdated_bsg = " + str(db_femtos_standby.timeupdated_bsg) ) # acquire locks and copy standby to active eeker.db_femtos = popLockAndDropIt(db_femtos_standby, eeker.dblock, "Thread_UpdateBSG__db_femtos_stoa") logging.debug( "Thread_UpdateBSG:\t" + "after leaving popLockAndDropIt, eeker.db_femtos.timeupdated_bsg = " + str(eeker.db_femtos.timeupdated_bsg) ) """ eeker.db_femtos.timeupdated_bsg = db_femtos_standby.timeupdated_bsg """ db_femtos_standby = None logging.debug("Thread_UpdateBSG: At end of thread: Type of eeker.db_femtos = " + str(type(eeker.db_femtos))) logging.debug("Thread_UpdateBSG: At end of thread: Type of eeker.db_alarmso = " + str(type(eeker.db_alarmso))) logging.debug("Thread_UpdateBSG: At end of thread: Type of eeker.db_alarmsd = " + str(type(eeker.db_alarmsd))) eeker.updatingalready_lock.acquire() eeker.updatingalready = False eeker.updatingalready_lock.release() logging.debug("Thread_UpdateBSG: STOPPING") return
def initFEMTOS(silent=None): """ This function only to be run when blowing away entire eeker.db_femtos only called by Thread_UpdateALL and Thread_initDB """ myfunc = str(pmLoaders.giveupthefunc()) logging.debug(myfunc + "\t" + "Beginning initFEMTOS() function") logging.debug(myfunc + "\t" + "At beginning of func: Type of eeker.db_femtos = " + str(type(eeker.db_femtos))) logging.debug(myfunc + "\t" + "At beginning of func: Type of eeker.db_alarmso = " + str(type(eeker.db_alarmso))) logging.debug(myfunc + "\t" + "At beginning of func: Type of eeker.db_alarmsd = " + str(type(eeker.db_alarmsd))) if silent == None: silent = False eeker.updatingalready_lock.acquire() eeker.updatingalready = True eeker.updatingalready_lock.release() # will stop csv writing to disk no matter what (e.g., eeker.csvdumpbool) supresswrite = True # set this so we know we're loading all fresh instead of refreshing registrationsupdateflag = False showupdatedbool = False # since registrationsupdateflag is set, buildInv_BSG will blow away existing # and create new anyways, so it doesn't matter what we pass it as long as it's # iterable, so we'll just make a blank list db_femtos_standby = pmClasses.SuperList() logging.info(myfunc + "\t" + "Kicking off 'buildInv_BSG' function...") """Here we'll run the buildInv_BSG function and pass in the config class object and a few other options including the current blank inventory db, it will return a SuperList()""" db_femtos_standby = pmLoaders.buildInv_BSG( supresswrite, registrationsupdateflag, pmConfig.fgwList, db_femtos_standby, # dummy list showupdatedbool, silent, ) logging.info(myfunc + "\t" + "Kicking off 'buildInv_WICL' function...") updateWICLbool = True """Now that the BSG portion has been run we can run the WICL portion which is now loading from a file on disk location specified in pmConfig""" db_femtos_standby = pmLoaders.buildInv_WICL(supresswrite, updateWICLbool, db_femtos_standby, eeker.db_cts, silent) # update use cases if that option is set if eeker.ucgranoption: logging.info(myfunc + "\t" + "Kicking off 'usecase_loaddata()' function...") db_femtos_standby = pmLoaders.usecase_loaddata(db_femtos_standby) """At this point we have an db_femtos_standby inventory DB made up of running the two build functions--BSG then WICL""" # acquire locks and copy standby to active eeker.db_femtos = popLockAndDropIt(db_femtos_standby, eeker.dblock, "initFEMTOS__db_femtos_stoa") """ # copy over timestamps from standby to active eeker.db_femtos.timeupdated_bsg = db_femtos_standby.timeupdated_bsg eeker.db_femtos.timeupdated_wms = db_femtos_standby.timeupdated_wms """ db_alarmso_standby = None db_femtos_standby = None logging.debug(myfunc + "\t" + "At end of func: Type of eeker.db_femtos = " + str(type(eeker.db_femtos))) logging.debug(myfunc + "\t" + "At end of func: Type of eeker.db_alarmso = " + str(type(eeker.db_alarmso))) logging.debug(myfunc + "\t" + "At end of func: Type of eeker.db_alarmsd = " + str(type(eeker.db_alarmsd))) eeker.updatingalready_lock.acquire() eeker.updatingalready = False eeker.updatingalready_lock.release() logging.debug(myfunc + "\t" + "Exiting initFEMTOS() function")