def notlambda(this): cond.acquire() ScanHandler.reset_stats(self) SQLSupport.reset_all() this.sql_consensus_listener.update_consensus() this.sql_consensus_listener._update_rank_history(this.sql_consensus_listener.consensus.ns_map.iterkeys()) SQLSupport.refresh_all() cond.notify() cond.release()
def save_sql_file(self, sql_file, new_file): cond = threading.Condition() def notlambda(this): cond.acquire() SQLSupport.tc_session.close() try: shutil.copy(sql_file, new_file) except Exception,e: plog("WARN", "Error moving sql file: "+str(e)) SQLSupport.reset_all() cond.notify() cond.release()
def attach_sql_listener(self, db_uri): plog("DEBUG", "Got sqlite: " + db_uri) SQLSupport.setup_db(db_uri, echo=False, drop=True) self.sql_consensus_listener = SQLSupport.ConsensusTrackerListener() self.add_event_listener(self.sql_consensus_listener) self.add_event_listener(SQLSupport.StreamListener())