Ask Solem пре 12 година
родитељ
комит
ab0550818d
2 измењених фајлова са 4 додато и 11 уклоњено
  1. 2 4
      celery/bootsteps.py
  2. 2 7
      celery/concurrency/processes.py

+ 2 - 4
celery/bootsteps.py

@@ -208,9 +208,7 @@ class Blueprint(object):
         return self.steps[name]
 
     def _find_last(self):
-        for C in values(self.steps):
-            if C.last:
-                return C
+        return next((C for C in values(self.steps) if C.last), None)
 
     def _firstpass(self, steps):
         stream = deque(step.requires for step in values(steps))
@@ -312,7 +310,7 @@ class Step(object):
         pass
 
     def include_if(self, parent):
-        """An optional predicate that decided whether this
+        """An optional predicate that decides whether this
         step should be created."""
         return self.enabled
 

+ 2 - 7
celery/concurrency/processes.py

@@ -162,7 +162,7 @@ class ResultHandler(_pool.ResultHandler):
                 else:
                     ready, task = False, None
             except (IOError, EOFError) as exc:
-                debug('result handler got %r -- exiting' % (exc, ))
+                debug('result handler got %r -- exiting', exc)
                 raise CoroStop()
 
             if self._state:
@@ -646,12 +646,7 @@ class TaskPool(BasePool):
                     try:
                         # keep track of what process the write operation
                         # was scheduled for.
-                        job._scheduled_for = fileno_to_inq[ready_fd]
-                    except KeyError:
-                        # process gone since scheduled, put it back
-                        return put_message(job)
-                    try:
-                        proc = fileno_to_inq[ready_fd]
+                        proc = job._scheduled_for = fileno_to_inq[ready_fd]
                     except KeyError:
                         # write was scheduled for this fd but the process
                         # has since exited and the message must be sent to