From 834a79814e5cedcdb28f2f03e706bea3cfeaf0bb Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Sun, 13 Nov 2011 22:31:00 +0100 Subject: [PATCH] Rename task -> job. Just a gift from a non-mainframe guy to a mainframe guy. Love is all about giving ;) --- __init__.py | 2 +- worker.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/__init__.py b/__init__.py index 96b8c9e..c125891 100644 --- a/__init__.py +++ b/__init__.py @@ -20,7 +20,7 @@ class DelayedResult(object): return self._rv -class task(object): +class job(object): def __init__(self, queue='normal'): self.queue = queue diff --git a/worker.py b/worker.py index 4745642..eee1c0d 100644 --- a/worker.py +++ b/worker.py @@ -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: