瀏覽代碼

Merge branch 'master' of github.com:celery/celery

Ask Solem 8 年之前
父節點
當前提交
7d574b60db
共有 4 個文件被更改,包括 8 次插入7 次删除
  1. 3 2
      celery/app/__init__.py
  2. 4 3
      celery/utils/serialization.py
  3. 0 1
      celery/worker/loops.py
  4. 1 1
      docs/userguide/optimizing.rst

+ 3 - 2
celery/app/__init__.py

@@ -96,17 +96,18 @@ def shared_task(*args, **kwargs):
         current apps task registry.
 
     Example:
+
         >>> from celery import Celery, shared_task
         >>> @shared_task
         ... def add(x, y):
         ...     return x + y
-
+        ...
         >>> app1 = Celery(broker='amqp://')
         >>> add.app is app1
         True
-
         >>> app2 = Celery(broker='redis://')
         >>> add.app is app2
+        True
     """
 
     def create_shared_task(**options):

+ 4 - 3
celery/utils/serialization.py

@@ -24,7 +24,7 @@ try:
 except ImportError:
     import pickle  # noqa
 
-PY3 = sys.version_info[0] >= 3
+PY33 = sys.version_info >= (3, 3)
 
 __all__ = [
     'UnpickleableExceptionWrapper', 'subclass_exception',
@@ -241,7 +241,9 @@ def jsonify(obj,
         return unknown_type_filter(obj)
 
 
-if PY3:
+# Since PyPy 3 targets Python 3.2, 'raise exc from None' will
+# raise a TypeError so we need to look for Python 3.3 or newer
+if PY33:  # pragma: no cover
     from vine.five import exec_
     _raise_with_context = None  # for flake8
     exec_("""def _raise_with_context(exc, ctx): raise exc from ctx""")
@@ -263,4 +265,3 @@ else:
         elif exc_info[2]:
             reraise(type(exc), exc, exc_info[2])
         raise exc
-

+ 0 - 1
celery/worker/loops.py

@@ -102,7 +102,6 @@ def synloop(obj, connection, consumer, blueprint, hub, qos,
     """Fallback blocking event loop for transports that doesn't support AIO."""
 
     on_task_received = obj.create_task_handler()
-    #_enable_amqheartbeats(obj.timer, connection, rate=hbrate)
     perform_pending_operations = obj.perform_pending_operations
     consumer.on_message = on_task_received
     consumer.consume()

+ 1 - 1
docs/userguide/optimizing.rst

@@ -142,7 +142,7 @@ or that the messages may not even fit in memory.
 
 The workers' default prefetch count is the
 :setting:`worker_prefetch_multiplier` setting multiplied by the number
-of concurrency slots[*]_ (processes/threads/green-threads).
+of concurrency slots [*]_ (processes/threads/green-threads).
 
 If you have many tasks with a long duration you want
 the multiplier value to be *one*: meaning it'll only reserve one