|
|
@ -6,7 +6,7 @@ import uuid
|
|
|
|
|
|
|
|
|
|
|
|
from .connections import resolve_connection
|
|
|
|
from .connections import resolve_connection
|
|
|
|
from .job import Job, Status
|
|
|
|
from .job import Job, Status
|
|
|
|
from .utils import utcnow
|
|
|
|
from .utils import import_attribute, utcnow
|
|
|
|
|
|
|
|
|
|
|
|
from .exceptions import (DequeueTimeout, InvalidJobOperationError,
|
|
|
|
from .exceptions import (DequeueTimeout, InvalidJobOperationError,
|
|
|
|
NoSuchJobError, UnpickleError)
|
|
|
|
NoSuchJobError, UnpickleError)
|
|
|
@ -55,7 +55,7 @@ class Queue(object):
|
|
|
|
return cls(name, connection=connection)
|
|
|
|
return cls(name, connection=connection)
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, name='default', default_timeout=None, connection=None,
|
|
|
|
def __init__(self, name='default', default_timeout=None, connection=None,
|
|
|
|
async=True):
|
|
|
|
async=True, job_class=None):
|
|
|
|
self.connection = resolve_connection(connection)
|
|
|
|
self.connection = resolve_connection(connection)
|
|
|
|
prefix = self.redis_queue_namespace_prefix
|
|
|
|
prefix = self.redis_queue_namespace_prefix
|
|
|
|
self.name = name
|
|
|
|
self.name = name
|
|
|
@ -63,6 +63,11 @@ class Queue(object):
|
|
|
|
self._default_timeout = default_timeout
|
|
|
|
self._default_timeout = default_timeout
|
|
|
|
self._async = async
|
|
|
|
self._async = async
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if job_class is not None:
|
|
|
|
|
|
|
|
if isinstance(job_class, string_types):
|
|
|
|
|
|
|
|
job_class = import_attribute(job_class)
|
|
|
|
|
|
|
|
self.job_class = job_class
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
@property
|
|
|
|
def key(self):
|
|
|
|
def key(self):
|
|
|
|
"""Returns the Redis key for this Queue."""
|
|
|
|
"""Returns the Redis key for this Queue."""
|
|
|
|