|
|
@ -138,15 +138,17 @@ class Queue(object):
|
|
|
|
'Functions from the __main__ module cannot be processed '
|
|
|
|
'Functions from the __main__ module cannot be processed '
|
|
|
|
'by workers.')
|
|
|
|
'by workers.')
|
|
|
|
|
|
|
|
|
|
|
|
# Warn about the timeout flag that has been removed
|
|
|
|
# Detect explicit invocations, i.e. of the form:
|
|
|
|
if 'timeout' in kwargs:
|
|
|
|
# q.enqueue(foo, args=(1, 2), kwargs={'a': 1}, timeout=30)
|
|
|
|
import warnings
|
|
|
|
if 'args' in kwargs or 'kwargs' in kwargs:
|
|
|
|
warnings.warn('The use of the timeout kwarg is not supported '
|
|
|
|
assert args == (), 'Extra positional arguments cannot be used when using explicit args and kwargs.' # noqa
|
|
|
|
'anymore. If you meant to pass this argument to RQ '
|
|
|
|
options = kwargs
|
|
|
|
'(rather than to %r), use the `.enqueue_call()` '
|
|
|
|
args = kwargs.pop('args', None)
|
|
|
|
'method instead.' % f, DeprecationWarning)
|
|
|
|
kwargs = kwargs.pop('kwargs', None)
|
|
|
|
|
|
|
|
else:
|
|
|
|
return self.enqueue_call(func=f, args=args, kwargs=kwargs)
|
|
|
|
options = {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return self.enqueue_call(func=f, args=args, kwargs=kwargs, **options)
|
|
|
|
|
|
|
|
|
|
|
|
def enqueue_job(self, job, timeout=None, set_meta_data=True):
|
|
|
|
def enqueue_job(self, job, timeout=None, set_meta_data=True):
|
|
|
|
"""Enqueues a job for delayed execution.
|
|
|
|
"""Enqueues a job for delayed execution.
|
|
|
|