瀏覽代碼

Warns if CELERYD_POOL used with eventlet/gevent. Issue #1611

Ask Solem 11 年之前
父節點
當前提交
644983a4f4
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      celery/worker/components.py

+ 9 - 0
celery/worker/components.py

@@ -9,6 +9,7 @@
 from __future__ import absolute_import
 
 import atexit
+import warnings
 
 from kombu.async import Hub as _Hub, get_event_loop, set_event_loop
 from kombu.async.semaphore import DummyLock, LaxBoundedSemaphore
@@ -26,6 +27,12 @@ ERR_B_GREEN = """\
 use standalone beat instead.\
 """
 
+W_POOL_SETTING = """
+The CELERYD_POOL setting should not be used to select the eventlet/gevent
+pools, instead you *must use the -P* argument so that patches are applied
+as early as possible.
+"""
+
 
 class Timer(bootsteps.Step):
     """This step initializes the internal timer used by the worker."""
@@ -141,6 +148,8 @@ class Pool(bootsteps.StartStopStep):
             w.pool.terminate()
 
     def create(self, w, semaphore=None, max_restarts=None):
+        if w.app.conf.CELERYD_POOL in ('eventlet', 'gevent'):
+            warnings.warn(UserWarning(W_POOL_SETTING))
         threaded = not w.use_eventloop
         procs = w.min_concurrency
         forking_enable = w.no_execv if w.force_execv else True