Prechádzať zdrojové kódy

Merge branch '3.0'

Conflicts:
	Changelog
	celery/canvas.py
	celery/utils/timeutils.py
	celery/worker/consumer.py
Ask Solem 12 rokov pred
rodič
commit
2be0657fb2
4 zmenil súbory, kde vykonal 79 pridanie a 12 odobranie
  1. 63 0
      Changelog
  2. 2 0
      celery/app/base.py
  3. 0 2
      celery/utils/timeutils.py
  4. 14 10
      celery/worker/consumer.py

+ 63 - 0
Changelog

@@ -18,6 +18,69 @@ If you're looking for versions prior to 3.0.x you should go to :ref:`history`.
 
 See :ref:`whatsnew-3.1`
 
+.. _version-3.0.13:
+
+3.0.13
+======
+:release-date: TBA
+
+- Fixed a deadlock issue that could occur when the producer pool
+  inherited the connection pool instance of the parent process.
+
+- The :option:`--loader` option now works again (Issue #1066).
+
+- :program:`celery` umbrella command: All subcommands now supports
+  the :option:`--workdir` option (Issue #1063).
+
+- Groups included in chains now give GroupResults (Issue #1057)
+
+    Previously it would incorrectly add a regular result instead of a group
+    result, but now this works:
+
+    .. code-block:: python
+
+        # [4 + 4, 4 + 8, 16 + 8]
+        >>> res = (add.s(2, 2) | group(add.s(4), add.s(8), add.s(16)))()
+        >>> res
+        <GroupResult: a0acf905-c704-499e-b03a-8d445e6398f7 [
+            4346501c-cb99-4ad8-8577-12256c7a22b1,
+            b12ead10-a622-4d44-86e9-3193a778f345,
+            26c7a420-11f3-4b33-8fac-66cd3b62abfd]>
+
+
+- Chains can now chain other chains and use partial arguments (Issue #1057).
+
+    Example:
+
+    .. code-block:: python
+
+        >>> c1 = (add.s(2) | add.s(4))
+        >>> c2 = (add.s(8) | add.s(16))
+
+        >>> c3 = (c1 | c2)
+
+        # 8 + 2 + 4 + 8 + 16
+        >>> assert c3(8).get() == 38
+
+- The :program:`celery shell` command now always adds the current
+  directory to the module path.
+
+- The worker will now properly handle the :exc:`pytz.AmbiguousTimeError`
+  exception raised when an ETA/countdown is prepared while being in DST
+  transition (Issue #1061).
+
+- force_execv: Now makes sure that task symbols in the original
+  task modules will always use the correct app instance (Issue #1072).
+
+- Handling of ETA/countdown fixed when the :setting:`CELERY_ENABLE_UTC`
+   setting is disabled (Issue #1065).
+
+- Fixed a typo in the broadcast routing documentation (Issue #1026).
+
+- Rewrote confusing section about idempotence in the task user guide.
+
+- Fixed typo in the daemonization tutorial (Issue #1055).
+
 .. _version-3.0.12:
 
 3.0.12

+ 2 - 0
celery/app/base.py

@@ -50,6 +50,8 @@ def app_has_custom(app, attr):
     return mro_lookup(app.__class__, attr, stop=(Celery, object),
                       monkey_patched=[__name__])
 
+_EXECV = os.environ.get('FORKED_BY_MULTIPROCESSING')
+
 
 def _unpickle_appattr(reverse_name, args):
     """Given an attribute name and a list of args, gets

+ 0 - 2
celery/utils/timeutils.py

@@ -24,7 +24,6 @@ from .functional import dictfilter
 from .iso8601 import parse_iso8601
 from .text import pluralize
 
-
 C_REMDEBUG = os.environ.get('C_REMDEBUG', False)
 
 DAYNAMES = 'sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'
@@ -34,7 +33,6 @@ RATE_MODIFIER_MAP = {'s': lambda n: n,
                      'm': lambda n: n / 60.0,
                      'h': lambda n: n / 60.0 / 60.0}
 
-
 HAVE_TIMEDELTA_TOTAL_SECONDS = hasattr(timedelta, 'total_seconds')
 
 TIME_UNITS = (('day',    60 * 60 * 24.0, lambda n: format(n, '.2f')),

+ 14 - 10
celery/worker/consumer.py

@@ -31,10 +31,10 @@ from celery.app import app_or_default
 from celery.canvas import subtask
 from celery.five import items, values
 from celery.task.trace import build_tracer
-from celery.utils.timer2 import default_timer, to_timestamp
 from celery.utils.functional import noop
 from celery.utils.log import get_logger
 from celery.utils.text import truncate
+from celery.utils.timer2 import default_timer, to_timestamp
 from celery.utils.timeutils import humanize_seconds, timezone
 
 from . import heartbeat, loops, pidbox
@@ -276,16 +276,20 @@ class Consumer(object):
     def add_task_queue(self, queue, exchange=None, exchange_type=None,
             routing_key=None, **options):
         cset = self.task_consumer
-        try:
-            q = self.app.amqp.queues[queue]
-        except KeyError:
+        queues = self.app.amqp.queues
+        # Must use in' here, as __missing__ will automatically
+        # create queues when CELERY_CREATE_MISSING_QUEUES is enabled.
+        # (Issue #1079)
+        if queue in queues:
+            q = queues[queue]
+        else:
             exchange = queue if exchange is None else exchange
-            exchange_type = 'direct' if exchange_type is None \
-                                     else exchange_type
-            q = self.app.amqp.queues.select_add(queue,
-                    exchange=exchange,
-                    exchange_type=exchange_type,
-                    routing_key=routing_key, **options)
+            exchange_type = ('direct' if   exchange_type is None
+                                      else exchange_type)
+            q = queues.select_add(queue,
+                                  exchange=exchange,
+                                  exchange_type=exchange_type,
+                                  routing_key=routing_key, **options)
         if not cset.consuming_from(queue):
             cset.add_queue(q)
             cset.consume()