|
|
@ -17,7 +17,7 @@ class job(object): # noqa
|
|
|
|
def __init__(self, queue, connection=None, timeout=None,
|
|
|
|
def __init__(self, queue, connection=None, timeout=None,
|
|
|
|
result_ttl=DEFAULT_RESULT_TTL, ttl=None,
|
|
|
|
result_ttl=DEFAULT_RESULT_TTL, ttl=None,
|
|
|
|
queue_class=None, depends_on=None, at_front=None, meta=None,
|
|
|
|
queue_class=None, depends_on=None, at_front=None, meta=None,
|
|
|
|
description=None, failure_ttl=None):
|
|
|
|
description=None, failure_ttl=None, retry=None):
|
|
|
|
"""A decorator that adds a ``delay`` method to the decorated function,
|
|
|
|
"""A decorator that adds a ``delay`` method to the decorated function,
|
|
|
|
which in turn creates a RQ job when called. Accepts a required
|
|
|
|
which in turn creates a RQ job when called. Accepts a required
|
|
|
|
``queue`` argument that can be either a ``Queue`` instance or a string
|
|
|
|
``queue`` argument that can be either a ``Queue`` instance or a string
|
|
|
@ -40,6 +40,7 @@ class job(object): # noqa
|
|
|
|
self.at_front = at_front
|
|
|
|
self.at_front = at_front
|
|
|
|
self.description = description
|
|
|
|
self.description = description
|
|
|
|
self.failure_ttl = failure_ttl
|
|
|
|
self.failure_ttl = failure_ttl
|
|
|
|
|
|
|
|
self.retry = retry
|
|
|
|
|
|
|
|
|
|
|
|
def __call__(self, f):
|
|
|
|
def __call__(self, f):
|
|
|
|
@wraps(f)
|
|
|
|
@wraps(f)
|
|
|
@ -63,6 +64,7 @@ class job(object): # noqa
|
|
|
|
return queue.enqueue_call(f, args=args, kwargs=kwargs,
|
|
|
|
return queue.enqueue_call(f, args=args, kwargs=kwargs,
|
|
|
|
timeout=self.timeout, result_ttl=self.result_ttl,
|
|
|
|
timeout=self.timeout, result_ttl=self.result_ttl,
|
|
|
|
ttl=self.ttl, depends_on=depends_on, job_id=job_id, at_front=at_front,
|
|
|
|
ttl=self.ttl, depends_on=depends_on, job_id=job_id, at_front=at_front,
|
|
|
|
meta=self.meta, description=self.description, failure_ttl=self.failure_ttl)
|
|
|
|
meta=self.meta, description=self.description, failure_ttl=self.failure_ttl,
|
|
|
|
|
|
|
|
retry=self.retry)
|
|
|
|
f.delay = delay
|
|
|
|
f.delay = delay
|
|
|
|
return f
|
|
|
|
return f
|
|
|
|