scheduler.py

Fri, 19 Jan 2018 16:00:36 +0000

author
Tuomo Valkonen <tuomov@iki.fi>
date
Fri, 19 Jan 2018 16:00:36 +0000
changeset 5
4c5514b2fa76
parent 1
4cdc9c1f6b28
child 7
e189d4a6cb8c
permissions
-rw-r--r--

basic schedule calculation

#
# Borgend scheduler
#

from Queue import Queue
from runborg import BorgInstance
import sched
import ui

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

class Scheduler:

    def __init__(self, backups):
        self.backups=backups
        self.eventqueue=Queue()
        self.t=Thread(target=scheduler, args=self)

mercurial