def _start_repeating_thread(f, interval_secs, is_absolute): class T(RepeatingTask): def tick(self): f() t = RepeatingTaskThread(T(interval_secs, is_absolute)) t.start() return t
def create_and_start_task_threads(tasks): global task_threads task_threads = [] for task in tasks: try: rtthread = RepeatingTaskThread(task) rtthread.setDaemon(True) # don't let thread block exit rtthread.start() task_threads.append(rtthread) except: main_logger.fatal("Error starting thread for task %s" % task.get_name(), exc_info=True) return False return True