Ask Solem 15 years ago
parent
commit
e2a84371c2
4 changed files with 12 additions and 12 deletions
  1. 1 1
      celery/backends/base.py
  2. 8 9
      celery/pool.py
  3. 2 1
      celery/tests/test_discovery.py
  4. 1 1
      contrib/testdynpool.py

+ 1 - 1
celery/backends/base.py

@@ -181,7 +181,7 @@ class BaseBackend(object):
             elif status == "FAILURE":
                 raise self.get_result(task_id)
             # avoid hammering the CPU checking status.
-            time.sleep(sleep_inbetween) 
+            time.sleep(sleep_inbetween)
             time_elapsed += sleep_inbetween
             if timeout and time_elapsed >= timeout:
                 raise TimeoutError("The operation timed out.")

+ 8 - 9
celery/pool.py

@@ -17,7 +17,7 @@ from operator import isNumberType
 
 def pid_is_dead(pid):
     """Check if a process is not running by PID.
-   
+
     :rtype bool:
 
     """
@@ -34,7 +34,7 @@ def pid_is_dead(pid):
 
 def reap_process(pid):
     """Reap process if the process is a zombie.
-   
+
     :returns: ``True`` if process was reaped or is not running,
         ``False`` otherwise.
 
@@ -50,7 +50,7 @@ def reap_process(pid):
         raise
     return is_dead
 
-    
+
 def process_is_dead(process):
     """Check if process is not running anymore.
 
@@ -71,7 +71,7 @@ def process_is_dead(process):
 
     if reap_process(process.pid):
         return True
-    
+
     # Then try to ping the process using its pipe.
     try:
         proc_is_alive = process.is_alive()
@@ -131,9 +131,9 @@ class DynamicPool(Pool):
 
     def grow(self, size=1):
         """Add workers to the pool.
-       
+
         :keyword size: Number of workers to add (default: 1)
-        
+
         """
         [self.add_worker() for i in range(size)]
 
@@ -161,11 +161,11 @@ class DynamicPool(Pool):
             if process and process.pid and isNumberType(process.pid):
                 dest = dead if self._is_dead(process) else alive
                 dest.append(process)
-        return dead, alive 
+        return dead, alive
 
     def replace_dead_workers(self):
         """Replace dead workers in the pool by spawning new ones.
-        
+
         :returns: number of dead processes replaced, or ``None`` if all
             processes are alive and running.
 
@@ -247,7 +247,6 @@ class TaskPool(object):
         return self._pool.apply_async(target, args, kwargs,
                                         callback=on_return)
 
-
     def on_return(self, callbacks, errbacks, on_ack, meta, ret_value):
         """What to do when the process returns."""
 

+ 2 - 1
celery/tests/test_discovery.py

@@ -19,5 +19,6 @@ class TestDiscovery(unittest.TestCase):
 
     def test_discovery_with_broken(self):
         if "someapp" in settings.INSTALLED_APPS:
-            settings.INSTALLED_APPS = settings.INSTALLED_APPS + ["xxxnot.aexist"]
+            settings.INSTALLED_APPS = settings.INSTALLED_APPS + \
+                    ["xxxnot.aexist"]
             self.assertDiscovery()

+ 1 - 1
contrib/testdynpool.py

@@ -42,7 +42,7 @@ def workpool():
     time.sleep(2)
     pool.replace_dead_workers()
     do_work(pool)
-  
+
 
 if __name__ == "__main__":
     workpool()