scheduler.py

changeset 1
4cdc9c1f6b28
child 7
e189d4a6cb8c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scheduler.py	Thu Jan 18 23:01:16 2018 +0000
@@ -0,0 +1,24 @@
+#
+# 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