Renamed job_id to id, and fixed py3 bug, per #415

main
foxx 10 years ago
parent 2753f17e8e
commit f5779c194f

@ -95,7 +95,7 @@ class Job(object):
@classmethod
def create(cls, func, args=None, kwargs=None, connection=None,
result_ttl=None, status=None, description=None, depends_on=None, timeout=None,
job_id=None):
id=None):
"""Creates a new Job instance for the given function, arguments, and
keyword arguments.
"""
@ -108,12 +108,12 @@ class Job(object):
raise TypeError('{0!r} is not a valid args list.'.format(args))
if not isinstance(kwargs, dict):
raise TypeError('{0!r} is not a valid kwargs dict.'.format(kwargs))
if not isinstance(job_id, (str, unicode, types.NoneType)):
raise TypeError('job_id must be a str/unicode, not {0}.'.format(type(job_id)))
if not isinstance(id, (string_types, types.NoneType)):
raise TypeError('id must be a string, not {0}.'.format(type(id)))
job = cls(connection=connection)
if job_id is not None:
job.set_id(job_id)
if id is not None:
job.set_id(id)
# Set the core job tuple properties
job._instance = None

@ -164,7 +164,7 @@ class Queue(object):
def enqueue_call(self, func, args=None, kwargs=None, timeout=None,
result_ttl=None, description=None, depends_on=None,
job_id=None):
id=None):
"""Creates a job to represent the delayed function call and enqueues
it.
@ -178,7 +178,7 @@ class Queue(object):
job = self.job_class.create(func, args, kwargs, connection=self.connection,
result_ttl=result_ttl, status=Status.QUEUED,
description=description, depends_on=depends_on, timeout=timeout,
job_id=job_id)
id=id)
# If job depends on an unfinished job, register itself on it's
# parent's dependents instead of enqueueing it.
@ -234,7 +234,7 @@ class Queue(object):
return self.enqueue_call(func=f, args=args, kwargs=kwargs,
timeout=timeout, result_ttl=result_ttl,
description=description, depends_on=depends_on,
job_id=job_id)
id=job_id)
def enqueue_job(self, job, set_meta_data=True):
"""Enqueues a job for delayed execution.

Loading…
Cancel
Save