#!/usr/bin/python3 # -*- coding: utf-8 -*- # Author: İsmail BAŞARAN from base.scheduler.base_scheduler import BaseScheduler from base.Scope import Scope from datetime import datetime, timedelta import time class CustomScheduler(BaseScheduler): def __init__(self): self.events = [] self.keep_run = True self.logger = Scope.getInstance().getLogger() def initialize(self): # Implement this from your implementation class pass def add_job(self,job): self.events.append(job) def stop(self): self.keep_run = False def run(self): t = datetime(*datetime.now().timetuple()[:5]) while 1 and self.keep_run: for e in self.events: e.check(t) t += timedelta(minutes=1) while datetime.now() < t: time.sleep((t - datetime.now()).seconds)