Added connection argument to get_current_job()

This commit is contained in:
Sylvain Zimmer 2014-01-20 11:41:15 -08:00
parent c106604f17
commit f0a3dd262e
1 changed files with 2 additions and 2 deletions

View File

@ -56,14 +56,14 @@ def requeue_job(job_id, connection=None):
fq.requeue(job_id)
def get_current_job():
def get_current_job(connection=None):
"""Returns the Job instance that is currently being executed. If this
function is invoked from outside a job context, None is returned.
"""
job_id = _job_stack.top
if job_id is None:
return None
return Job.fetch(job_id)
return Job.fetch(job_id, connection=connection)
class Job(object):