def initialize(self): self.log=LoggerFactory.get_file_logger(config.log_filename,"WeatherRealtimeUpdaterThread",config.log_level) self.log.info("Initializing") self.owm=OWM(config_private.openweather_key) self.connection=pymysql.connect(host=config_private.db_host,port=config_private.db_port,user=config_private.db_user,passwd=config_private.db_password,db=config_private.db_name) self.cursor=self.connection.cursor() self.log.info("Successfully initialized")
def initialize(self): self.log=LoggerFactory.get_file_logger(config.log_filename,"MPPTScannerThread",config.log_level) self.log.info("Initializing") self.mppt=EPSolarBSeries() self.mppt.set_real_time_clock() self.connection=pymysql.connect(host=config_private.db_host,port=config_private.db_port,user=config_private.db_user,passwd=config_private.db_password,db=config_private.db_name) self.cursor=self.connection.cursor() self.log.info("Successfully initialized")
def initialize(self): self.log=LoggerFactory.get_file_logger(config.log_filename,"MPPTMonitoringThread",config.log_level) self.log.info("Initializing") self.connection=pymysql.connect(host=config_private.db_host,port=config_private.db_port,user=config_private.db_user,passwd=config_private.db_password,db=config_private.db_name) self.cursor1=self.connection.cursor() # Scans each suitable MPPT_DATA_STATUS entries in a loop self.cursor2=self.connection.cursor() # Do other DB activities related to the content of cursor1 self.cursor3=self.connection.cursor() # Used to get status descriptions self.log.info("Successfully initialized")
def initialize(self): self.log=LoggerFactory.get_file_logger(config.log_filename,"LoadManagerThread",config.log_level) self.log.info("Initializing") load1=LED(config.load_1_pin) load2=LED(config.load_2_pin) load1.on() load2.on() time.sleep(1) load1.off() load2.off() time.sleep(1) load1.on() load2.on() self.log.info("Successfully initialized")
def __init__(self): self.threads=list() self.log=LoggerFactory.get_file_logger(config.log_filename,"ThreadManager",config.log_level)
def initialize(self): self.log=LoggerFactory.get_file_logger(config.log_filename,"DWHUpdaterThread",config.log_level) self.connection=pymysql.connect(host=config_p.db_host,port=config_p.db_port,user=config_p.db_user,passwd=config_p.db_password,db=config_p.db_name) self.cursor=self.connection.cursor()
try: running,pid=d.get_pid() except Exception as exc: print(exc.description) sys.exit(1) if running: print('Running, pid '+pid) else: print('Not running') sys.exit(0) ############## END OF COMMAND LINE PARSING ########### ## We get here only if we just have been daemonized ## ###################################################### log=LoggerFactory.get_file_logger(config.log_filename,"MAIN",config.log_level) log.critical("STARTING") tm=ThreadManager() try: tm.init_threads() tm.start_all() except Exception as exc: exc_type, exc_obj, exc_tb = sys.exc_info() log.critical("EXCEPTION WHILE INITIALIZING THREAD. TERMINATING."+str(traceback.extract_tb(exc_tb))) d.sigterm_handler=tm.stop_all d.stop() sys.exit(1) d.sigterm_handler=tm.stop_all