|
@@ -17,6 +17,7 @@ import sys
|
|
import traceback
|
|
import traceback
|
|
|
|
|
|
from collections import namedtuple
|
|
from collections import namedtuple
|
|
|
|
+from functools import total_ordering
|
|
from threading import Event, Thread
|
|
from threading import Event, Thread
|
|
|
|
|
|
from billiard import ensure_multiprocessing
|
|
from billiard import ensure_multiprocessing
|
|
@@ -50,6 +51,7 @@ class SchedulingError(Exception):
|
|
"""An error occured while scheduling a task."""
|
|
"""An error occured while scheduling a task."""
|
|
|
|
|
|
|
|
|
|
|
|
+@total_ordering
|
|
class ScheduleEntry(object):
|
|
class ScheduleEntry(object):
|
|
"""An entry in the scheduler.
|
|
"""An entry in the scheduler.
|
|
|
|
|
|
@@ -141,6 +143,11 @@ class ScheduleEntry(object):
|
|
call=reprcall(self.task, self.args or (), self.kwargs or {}),
|
|
call=reprcall(self.task, self.args or (), self.kwargs or {}),
|
|
)
|
|
)
|
|
|
|
|
|
|
|
+ def __lt__(self, other):
|
|
|
|
+ if isinstance(other, ScheduleEntry):
|
|
|
|
+ return id(self) < id(other)
|
|
|
|
+ return NotImplemented
|
|
|
|
+
|
|
|
|
|
|
class Scheduler(object):
|
|
class Scheduler(object):
|
|
"""Scheduler for periodic tasks.
|
|
"""Scheduler for periodic tasks.
|