def print_scheduler_info(self): if self.count % 100 == 0: self.count = 0 logging.info(" ========== Scheduling ==========") logging.info("-------- Geometry") logging.info("\t\t {} rows * {} cols".format( SchedulerState.get_rows(), SchedulerState.get_cols())) logging.info("-------- Disabled") logging.info("\t\t {}".format(SchedulerState.get_disabled())) logging.info("-------- Enable State") logging.info(SchedulerState.get_enable_state()) logging.info("-------- Is Frontage Up?") logging.info(SchedulerState.is_frontage_on()) logging.info("-------- Usable?") logging.info(SchedulerState.usable()) logging.info("-------- Current App") logging.info(SchedulerState.get_current_app()) logging.info('Forced App ? {}'.format( SchedulerState.get_forced_app())) logging.info("---------- Waiting Queue") logging.info(SchedulerState.get_user_app_queue()) if SchedulerState.get_enable_state() == 'scheduled': logging.info("---------- Scheduled ON") logging.info(SchedulerState.get_scheduled_on_time().strftime( "%d-%m-%Y %H:%M:%S UTC+00")) logging.info("---------- Scheduled OFF") logging.info(SchedulerState.get_scheduled_off_time().strftime( "%d-%m-%Y %H:%M:%S UTC+00")) logging.info("---------- TIME NOW") logging.info(datetime.datetime.now().strftime( "%d-%m-%Y %H:%M:%S UTC+00")) self.count += 1
def check_on_off_table(self): now = datetime.datetime.now() sunrise = SchedulerState.get_scheduled_off_time() sunset = SchedulerState.get_scheduled_on_time() if sunset < now and now < sunrise: SchedulerState.set_frontage_on(True) else: SchedulerState.set_frontage_on(False)
def print_scheduler_info(self): if self.count % 10 == 0: self.count = 0 print_flush(" ========== Scheduling ==========") print_flush("-------- Enable State") print_flush(SchedulerState.get_enable_state()) print_flush("-------- Is Frontage Up?") print_flush(SchedulerState.is_frontage_on()) print_flush("-------- Usable?") print_flush(SchedulerState.usable()) print_flush("-------- Current App") print_flush(SchedulerState.get_current_app()) print_flush('Forced App ?', SchedulerState.get_forced_app()) print_flush("---------- Waiting Queue") print_flush(SchedulerState.get_user_app_queue()) if SchedulerState.get_enable_state() == 'scheduled': print_flush("---------- Scheduled ON") print_flush(SchedulerState.get_scheduled_on_time()) print_flush("---------- Scheduled OFF") print_flush(SchedulerState.get_scheduled_off_time()) self.count += 1