示例#1
0
        def start(self):
            self.event = sched.enter(self.delay, 1, self.execute, ())

            try:
                sched.run()
            except Exception as e:  # pragma: no cover
                log.warning("[Timer] Scheduler error: %s", str(e))
示例#2
0
文件: Router.py 项目: balu-/deconzpy
 def __runScheduler(self, sched):
     maxSleep = 3
     while True:
         # print("Scheduling thread")
         try:
             wTime = sched.run(blocking=False)
         except Exception as e:
             logger.error("Exception in shedule event: %s", e)
             logger.exception(e)
         if wTime is None or wTime > maxSleep:
             wTime = maxSleep
         time.sleep(wTime)
示例#3
0
 def start(self):
     self.event = sched.enter(self.delay, 1, self.execute, ())
     try:
         sched.run()
     except Exception:
         pass
示例#4
0
 def start(self):
     self.event = sched.enter(self.delay, 1, self.execute, ())
     try:
         sched.run()
     except:
         pass
示例#5
0
        self.printLog("[CHECK END]")

    def getTime(self):
        return datetime.datetime.now()

    def printLog(self, msg):
        with open(self.log_path, 'a') as f:
            f.write("\n" + msg)

    def rmComma(self, stri):
        return stri.replace(",", "")


sched = sched.scheduler(time.time, time.sleep)
php = PHPWatchDog()
if php.error:
    print("\n[ERROR]Cannot read the config file.")
    exit()


def start(sc):
    php.test()
    sched.enter(php.delay, 1, start, (sc, ))


print("[START] PHPWatchDog started at [ " + str(php.getTime()) + " ]")
php.printLog("[START] PHPWatchDog started at [ " + str(php.getTime()) + " ]")
php.test()
sched.enter(php.delay, 1, start, (sched, ))
sched.run()
示例#6
0
 def start(self):
     self.event = sched.enter(self.delay, 1, self.execute, ())
     try:
         sched.run()
     except:  #pylint:disable=bare-except
         pass
示例#7
0
 def start(self):
     self.event = sched.enter(self.delay, 1, self.execute, ())
     try:
         sched.run()
     except:  # pylint:disable=bare-except
         pass
示例#8
0
def main():

    sched.enter(1, 1, run_request, (sched, ))
    sched.run()
示例#9
0
            for name, obj in inspect.getmembers(mod):
                if inspect.isclass(obj) and name != 'Module':
                    obj = obj(module['config']) if 'config' in module else obj()
                    widget = obj.widget()
                    components[module['label']] = {'object': obj, 'widget': widget}
                    if obj.refreshrate is not None:
                        sched.enter(obj.refreshrate, 1, refresh, (module['label'], widget, obj.refreshrate))
    return (assets, components)

# Initialise all the modules of the application
# and launch their automatic scheduled update
sched = sched.scheduler(time.time, time.sleep)
assets, components = loadmodules([
    {'label' : 'datetime', 'name': 'datetime'},
])
threading.Thread(target=lambda: sched.run()).start()

# Initialise the websocket server endpoint
queue = queue.Queue()
clients = set()

class MyServerProtocol(WebSocketServerProtocol):
    def __init__(self):
        super().__init__()
        clients.add(self)

    def onConnect(self, request):
        super().onConnect(request)

    def succeedHandshake(self, res):
        super().succeedHandshake(res)
示例#10
0
文件: test.py 项目: xyicheng/awaitexp
from sched import run, switch


async def coro1():
    print("C1: Start")
    await switch()
    print("C1: a")
    await switch()
    print("C1: b")
    await switch()
    print("C1: c")
    await switch()
    print("C1: Stop")


async def coro2():
    print("C2: Start")
    await switch()
    print("C2: a")
    await switch()
    print("C2: b")
    await switch()
    print("C2: c")
    await switch()
    print("C2: Stop")


run([coro1(), coro2()])
示例#11
0
文件: Window.py 项目: buffer/thug
 def start(self):
     self.event = sched.enter(self.delay, 1, self.execute, ())
     try:
         sched.run()
     except Exception as e:
         log.warning("[Timer] Scheduler error: %s", str(e))
示例#12
0
def main():

    sched.enter(1, 1, sqlping, (sched, ))
    sched.run()