Rename task -> job.

Just a gift from a non-mainframe guy to a mainframe guy.  Love is all
about giving ;)
main
Vincent Driessen 13 years ago
parent a5a8925608
commit 834a79814e

@ -20,7 +20,7 @@ class DelayedResult(object):
return self._rv
class task(object):
class job(object):
def __init__(self, queue='normal'):
self.queue = queue

@ -44,9 +44,9 @@ class Worker(object):
while True:
self.procline('Waiting on %s' % (', '.join(self.queue_names),))
queue, msg = conn.blpop(self.queue_keys)
self.fork_and_perform_task(queue, msg)
self.fork_and_perform_job(queue, msg)
def fork_and_perform_task(self, queue, msg):
def fork_and_perform_job(self, queue, msg):
child_pid = os.fork()
if child_pid == 0:
random.seed()
@ -54,7 +54,7 @@ class Worker(object):
try:
self.procline('Processing work since %d' % (time.time(),))
self._working = True
self.perform_task(queue, msg)
self.perform_job(queue, msg)
except Exception, e:
self.log.exception(e)
sys.exit(1)
@ -64,7 +64,7 @@ class Worker(object):
os.waitpid(child_pid, 0)
self._working = False
def perform_task(self, queue, msg):
def perform_job(self, queue, msg):
func, key, args, kwargs = loads(msg)
self.procline('Processing %s from %s since %s' % (func.__name__, queue, time.time()))
try:

Loading…
Cancel
Save