|
|
@ -1,4 +1,5 @@
|
|
|
|
import uuid
|
|
|
|
import uuid
|
|
|
|
|
|
|
|
from functools import total_ordering
|
|
|
|
from pickle import loads, dumps
|
|
|
|
from pickle import loads, dumps
|
|
|
|
from .proxy import conn
|
|
|
|
from .proxy import conn
|
|
|
|
|
|
|
|
|
|
|
@ -35,6 +36,7 @@ class Job(object):
|
|
|
|
return self.func(*self.args, **self.kwargs)
|
|
|
|
return self.func(*self.args, **self.kwargs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@total_ordering
|
|
|
|
class Queue(object):
|
|
|
|
class Queue(object):
|
|
|
|
redis_queue_namespace_prefix = 'rq:'
|
|
|
|
redis_queue_namespace_prefix = 'rq:'
|
|
|
|
|
|
|
|
|
|
|
@ -118,5 +120,21 @@ class Queue(object):
|
|
|
|
return job
|
|
|
|
return job
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Total ordering defition (the rest of the required Python methods are
|
|
|
|
|
|
|
|
# auto-generated by the @total_ordering decorator)
|
|
|
|
|
|
|
|
def __eq__(self, other):
|
|
|
|
|
|
|
|
if not isinstance(other, Queue):
|
|
|
|
|
|
|
|
raise TypeError('Cannot compare queues to other objects.')
|
|
|
|
|
|
|
|
return self.name == other.name
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def __lt__(self, other):
|
|
|
|
|
|
|
|
if not isinstance(other, Queue):
|
|
|
|
|
|
|
|
raise TypeError('Cannot compare queues to other objects.')
|
|
|
|
|
|
|
|
return self.name <= other.name
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def __hash__(self):
|
|
|
|
|
|
|
|
return hash(self.name)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
def __str__(self):
|
|
|
|
return self.name
|
|
|
|
return self.name
|
|
|
|