1 # |
1 # |
2 # Borgend scheduler |
2 # Borgend scheduler |
3 # |
3 # |
4 |
4 |
5 from Queue import Queue |
5 from Queue import Queue |
6 from runborg import BorgInstance |
|
7 import sched |
6 import sched |
8 import ui |
7 import ui |
9 |
8 |
10 def scheduler(sched): |
|
11 timeout=??? |
|
12 q=sched.eventqueue |
|
13 while True: |
|
14 timeout, timerevent=next_timed_event(sched); |
|
15 t=Timer(timeout, lambda: q.put(timerevent)); |
|
16 event=sq.get(True): |
|
17 # Decide what to do |
|
18 |
9 |
19 class Scheduler: |
10 class Scheduler: |
20 |
11 |
21 def __init__(self, backups): |
12 def __init__(self, backups): |
22 self.backups=backups |
13 self.backups=backups |
23 self.eventqueue=Queue() |
14 self.eventqueue=Queue() |
24 self.t=Thread(target=scheduler, args=self) |
15 self.t=Thread(target=self.__scheduler) |
|
16 t.start() |
|
17 |
|
18 def __scheduler(sched): |
|
19 timeout=??? |
|
20 q=sched.eventqueue |
|
21 while True: |
|
22 timeout, timerevent=next_timed_event(sched); |
|
23 t=Timer(timeout, lambda: q.put(timerevent)); |
|
24 event=sq.get(True): |
|
25 # Decide what to do |