scheduler.py

Sat, 20 Jan 2018 14:04:51 +0000

author
Tuomo Valkonen <tuomov@iki.fi>
date
Sat, 20 Jan 2018 14:04:51 +0000
changeset 7
e189d4a6cb8c
parent 1
4cdc9c1f6b28
permissions
-rw-r--r--

Also listen to stdout

#
# Borgend scheduler
#

from Queue import Queue
import sched
import ui


class Scheduler:

    def __init__(self, backups):
        self.backups=backups
        self.eventqueue=Queue()
        self.t=Thread(target=self.__scheduler)
        t.start()

    def __scheduler(sched):
        timeout=???
        q=sched.eventqueue
        while True:
            timeout, timerevent=next_timed_event(sched);
            t=Timer(timeout, lambda: q.put(timerevent));
            event=sq.get(True):
            # Decide what to do

mercurial