move actual execute to a separate method to make it easier to run async jobs

main
Marko Mrdjenovic 8 years ago
parent 3da3eab11d
commit 35fb6b0b9a

@ -497,11 +497,14 @@ class Job(object):
self.ttl = -1 self.ttl = -1
_job_stack.push(self.id) _job_stack.push(self.id)
try: try:
self._result = self.func(*self.args, **self.kwargs) self._result = self._execute()
finally: finally:
assert self.id == _job_stack.pop() assert self.id == _job_stack.pop()
return self._result return self._result
def _execute(self):
return self.func(*self.args, **self.kwargs)
def get_ttl(self, default_ttl=None): def get_ttl(self, default_ttl=None):
"""Returns ttl for a job that determines how long a job will be """Returns ttl for a job that determines how long a job will be
persisted. In the future, this method will also be responsible persisted. In the future, this method will also be responsible

Loading…
Cancel
Save