Debian Codegraph @

docs/history/whatsnew-3.0.rst

raw
1 .. _whatsnew-3.0:
2
3 ===========================================
4 What's new in Celery 3.0 (Chiastic Slide)
5 ===========================================
6
7 Celery is a simple, flexible, and reliable distributed system to
8 process vast amounts of messages, while providing operations with
9 the tools required to maintain such a system.
10
11 It's a task queue with focus on real-time processing, while also
12 supporting task scheduling.
13
14 Celery has a large and diverse community of users and contributors,
15 you should come join us :ref:`on IRC <irc-channel>`
16 or :ref:`our mailing-list <mailing-list>`.
17
18 To read more about Celery you should go read the :ref:`introduction <intro>`.
19
20 While this version is backward compatible with previous versions
21 it's important that you read the following section.
22
23 If you use Celery in combination with Django you must also
24 read the `django-celery changelog`_ and upgrade
25 to :pypi:`django-celery 3.0 <django-celery>`.
26
27 This version is officially supported on CPython 2.5, 2.6, 2.7, 3.2 and 3.3,
28 as well as PyPy and Jython.
29
30 Highlights
31 ==========
32
33 .. topic:: Overview
34
35 - A new and improved API, that's both simpler and more powerful.
36
37 Everyone must read the new :ref:`first-steps` tutorial,
38 and the new :ref:`next-steps` tutorial. Oh, and
39 why not reread the user guide while you're at it :)
40
41 There are no current plans to deprecate the old API,
42 so you don't have to be in a hurry to port your applications.
43
44 - The worker is now thread-less, giving great performance improvements.
45
46 - The new "Canvas" makes it easy to define complex work-flows.
47
48 Ever wanted to chain tasks together? This is possible, but
49 not just that, now you can even chain together groups and chords,
50 or even combine multiple chains.
51
52 Read more in the :ref:`Canvas <guide-canvas>` user guide.
53
54 - All of Celery's command-line programs are now available from a single
55 :program:`celery` umbrella command.
56
57 - This is the last version to support Python 2.5.
58
59 Starting with Celery 3.1, Python 2.6 or later is required.
60
61 - Support for the new :pypi:`librabbitmq` C client.
62
63 Celery will automatically use the :pypi:`librabbitmq` module
64 if installed, which is a very fast and memory-optimized
65 replacement for the :pypi:`amqp` module.
66
67 - Redis support is more reliable with improved ack emulation.
68
69 - Celery now always uses UTC
70
71 - Over 600 commits, 30k additions/36k deletions.
72
73 In comparison 1.0➝ 2.0 had 18k additions/8k deletions.
74
75
76 .. _`website`: http://celeryproject.org/
77 .. _`django-celery changelog`:
78 https://github.com/celery/django-celery/tree/master/Changelog
79
80 .. contents::
81 :local:
82 :depth: 2
83
84 .. _v300-important:
85
86 Important Notes
87 ===============
88
89 Broadcast exchanges renamed
90 ---------------------------
91
92 The workers remote control command exchanges has been renamed
93 (a new :term:`pidbox` name), this is because the ``auto_delete`` flag on
94 the exchanges has been removed, and that makes it incompatible with
95 earlier versions.
96
97 You can manually delete the old exchanges if you want,
98 using the :program:`celery amqp` command (previously called ``camqadm``):
99
100 .. code-block:: console
101
102 $ celery amqp exchange.delete celeryd.pidbox
103 $ celery amqp exchange.delete reply.celeryd.pidbox
104
105 Event-loop
106 ----------
107
108 The worker is now running *without threads* when used with RabbitMQ (AMQP),
109 or Redis as a broker, resulting in:
110
111 - Much better overall performance.
112 - Fixes several edge case race conditions.
113 - Sub-millisecond timer precision.
114 - Faster shutdown times.
115
116 The transports supported are: ``py-amqp`` ``librabbitmq``, ``redis``,
117 and ``amqplib``.
118 Hopefully this can be extended to include additional broker transports
119 in the future.
120
121 For increased reliability the :setting:`CELERY_FORCE_EXECV` setting is enabled
122 by default if the event-loop isn't used.
123
124 New ``celery`` umbrella command
125 -------------------------------
126
127 All Celery's command-line programs are now available from a single
128 :program:`celery` umbrella command.
129
130 You can see a list of sub-commands and options by running:
131
132 .. code-block:: console
133
134 $ celery help
135
136 Commands include:
137
138 - ``celery worker`` (previously ``celeryd``).
139
140 - ``celery beat`` (previously ``celerybeat``).
141
142 - ``celery amqp`` (previously ``camqadm``).
143
144 The old programs are still available (``celeryd``, ``celerybeat``, etc),
145 but you're discouraged from using them.
146
147 Now depends on :pypi:`billiard`
148 -------------------------------
149
150 Billiard is a fork of the multiprocessing containing
151 the no-execv patch by ``sbt`` (http://bugs.python.org/issue8713),
152 and also contains the pool improvements previously located in Celery.
153
154 This fork was necessary as changes to the C extension code was required
155 for the no-execv patch to work.
156
157 - Issue #625
158 - Issue #627
159 - Issue #640
160 - `django-celery #122 <https://github.com/celery/django-celery/issues/122`
161 - `django-celery #124 <https://github.com/celery/django-celery/issues/122`
162
163 :mod:`celery.app.task` no longer a package
164 ------------------------------------------
165
166 The :mod:`celery.app.task` module is now a module instead of a package.
167
168 The :file:`setup.py` install script will try to remove the old package,
169 but if that doesn't work for some reason you have to remove
170 it manually. This command helps:
171
172 .. code-block:: console
173
174 $ rm -r $(dirname $(python -c 'import celery;print(celery.__file__)'))/app/task/
175
176 If you experience an error like ``ImportError: cannot import name _unpickle_task``,
177 you just have to remove the old package and everything is fine.
178
179 Last version to support Python 2.5
180 ----------------------------------
181
182 The 3.0 series will be last version to support Python 2.5,
183 and starting from 3.1 Python 2.6 and later will be required.
184
185 With several other distributions taking the step to discontinue
186 Python 2.5 support, we feel that it is time too.
187
188 Python 2.6 should be widely available at this point, and we urge
189 you to upgrade, but if that's not possible you still have the option
190 to continue using the Celery 3.0, and important bug fixes
191 introduced in Celery 3.1 will be back-ported to Celery 3.0 upon request.
192
193 UTC timezone is now used
194 ------------------------
195
196 This means that ETA/countdown in messages aren't compatible with Celery
197 versions prior to 2.5.
198
199 You can disable UTC and revert back to old local time by setting
200 the :setting:`CELERY_ENABLE_UTC` setting.
201
202 Redis: Ack emulation improvements
203 ---------------------------------
204
205 Reducing the possibility of data loss.
206
207 Acks are now implemented by storing a copy of the message when the message
208 is consumed. The copy isn't removed until the consumer acknowledges
209 or rejects it.
210
211 This means that unacknowledged messages will be redelivered either
212 when the connection is closed, or when the visibility timeout is exceeded.
213
214 - Visibility timeout
215
216 This is a timeout for acks, so that if the consumer
217 doesn't ack the message within this time limit, the message
218 is redelivered to another consumer.
219
220 The timeout is set to one hour by default, but
221 can be changed by configuring a transport option::
222
223 BROKER_TRANSPORT_OPTIONS = {'visibility_timeout': 18000} # 5 hours
224
225
226 .. note::
227
228 Messages that haven't been acked will be redelivered
229 if the visibility timeout is exceeded, for Celery users
230 this means that ETA/countdown tasks that are scheduled to execute
231 with a time that exceeds the visibility timeout will be executed
232 twice (or more). If you plan on using long ETA/countdowns you
233 should tweak the visibility timeout accordingly.
234
235 Setting a long timeout means that it'll take a long time
236 for messages to be redelivered in the event of a power failure,
237 but if so happens you could temporarily set the visibility timeout lower
238 to flush out messages when you start up the systems again.
239
240 .. _v300-news:
241
242 News
243 ====
244
245 Chaining Tasks
246 --------------
247
248 Tasks can now have callbacks and errbacks, and dependencies are recorded
249
250 - The task message format have been updated with two new extension keys
251
252 Both keys can be empty/undefined or a list of subtasks.
253
254 - ``callbacks``
255
256 Applied if the task exits successfully, with the result
257 of the task as an argument.
258
259 - ``errbacks``
260
261 Applied if an error occurred while executing the task,
262 with the uuid of the task as an argument. Since it may not be possible
263 to serialize the exception instance, it passes the uuid of the task
264 instead. The uuid can then be used to retrieve the exception and
265 traceback of the task from the result backend.
266
267 - ``link`` and ``link_error`` keyword arguments has been added
268 to ``apply_async``.
269
270 These add callbacks and errbacks to the task, and
271 you can read more about them at :ref:`calling-links`.
272
273 - We now track what subtasks a task sends, and some result backends
274 supports retrieving this information.
275
276 - task.request.children
277
278 Contains the result instances of the subtasks
279 the currently executing task has applied.
280
281 - AsyncResult.children
282
283 Returns the tasks dependencies, as a list of
284 ``AsyncResult``/``ResultSet`` instances.
285
286 - AsyncResult.iterdeps
287
288 Recursively iterates over the tasks dependencies,
289 yielding `(parent, node)` tuples.
290
291 Raises IncompleteStream if any of the dependencies
292 hasn't returned yet.
293
294 - AsyncResult.graph
295
296 A :class:`~celery.utils.graph.DependencyGraph` of the tasks
297 dependencies. With this you can also convert to dot format:
298
299 .. code-block:: python
300
301 with open('graph.dot') as fh:
302 result.graph.to_dot(fh)
303
304 then produce an image of the graph:
305
306 .. code-block:: console
307
308 $ dot -Tpng graph.dot -o graph.png
309
310 - A new special subtask called ``chain`` is also included:
311
312 .. code-block:: pycon
313
314 >>> from celery import chain
315
316 # (2 + 2) * 8 / 2
317 >>> res = chain(add.subtask((2, 2)),
318 mul.subtask((8,)),
319 div.subtask((2,))).apply_async()
320 >>> res.get() == 16
321
322 >>> res.parent.get() == 32
323
324 >>> res.parent.parent.get() == 4
325
326 - Adds :meth:`AsyncResult.get_leaf`
327
328 Waits and returns the result of the leaf subtask.
329 That's the last node found when traversing the graph,
330 but this means that the graph can be 1-dimensional only (in effect
331 a list).
332
333 - Adds ``subtask.link(subtask)`` + ``subtask.link_error(subtask)``
334
335 Shortcut to ``s.options.setdefault('link', []).append(subtask)``
336
337 - Adds ``subtask.flatten_links()``
338
339 Returns a flattened list of all dependencies (recursively)
340
341 Redis: Priority support
342 -----------------------
343
344 The message's ``priority`` field is now respected by the Redis
345 transport by having multiple lists for each named queue.
346 The queues are then consumed by in order of priority.
347
348 The priority field is a number in the range of 0 - 9, where
349 0 is the default and highest priority.
350
351 The priority range is collapsed into four steps by default, since it is
352 unlikely that nine steps will yield more benefit than using four steps.
353 The number of steps can be configured by setting the ``priority_steps``
354 transport option, which must be a list of numbers in **sorted order**:
355
356 .. code-block:: pycon
357
358 >>> BROKER_TRANSPORT_OPTIONS = {
359 ... 'priority_steps': [0, 2, 4, 6, 8, 9],
360 ... }
361
362 Priorities implemented in this way isn't as reliable as
363 priorities on the server side, which is why
364 the feature is nicknamed "quasi-priorities";
365 **Using routing is still the suggested way of ensuring
366 quality of service**, as client implemented priorities
367 fall short in a number of ways, for example if the worker
368 is busy with long running tasks, has prefetched many messages,
369 or the queues are congested.
370
371 Still, it is possible that using priorities in combination
372 with routing can be more beneficial than using routing
373 or priorities alone. Experimentation and monitoring
374 should be used to prove this.
375
376 Contributed by Germán M. Bravo.
377
378 Redis: Now cycles queues so that consuming is fair
379 --------------------------------------------------
380
381 This ensures that a very busy queue won't block messages
382 from other queues, and ensures that all queues have
383 an equal chance of being consumed from.
384
385 This used to be the case before, but the behavior was
386 accidentally changed while switching to using blocking pop.
387
388
389 `group`/`chord`/`chain` are now subtasks
390 ----------------------------------------
391
392 - group is no longer an alias to ``TaskSet``, but new all together,
393 since it was very difficult to migrate the ``TaskSet`` class to become
394 a subtask.
395
396 - A new shortcut has been added to tasks:
397
398 .. code-block:: pycon
399
400 >>> task.s(arg1, arg2, kw=1)
401
402 as a shortcut to:
403
404 .. code-block:: pycon
405
406 >>> task.subtask((arg1, arg2), {'kw': 1})
407
408 - Tasks can be chained by using the ``|`` operator:
409
410 .. code-block:: pycon
411
412 >>> (add.s(2, 2), pow.s(2)).apply_async()
413
414 - Subtasks can be "evaluated" using the ``~`` operator:
415
416 .. code-block:: pycon
417
418 >>> ~add.s(2, 2)
419 4
420
421 >>> ~(add.s(2, 2) | pow.s(2))
422
423 is the same as:
424
425 .. code-block:: pycon
426
427 >>> chain(add.s(2, 2), pow.s(2)).apply_async().get()
428
429 - A new subtask_type key has been added to the subtask dictionary.
430
431 This can be the string ``"chord"``, ``"group"``, ``"chain"``,
432 ``"chunks"``, ``"xmap"``, or ``"xstarmap"``.
433
434 - maybe_subtask now uses subtask_type to reconstruct
435 the object, to be used when using non-pickle serializers.
436
437 - The logic for these operations have been moved to dedicated
438 tasks celery.chord, celery.chain and celery.group.
439
440 - subtask no longer inherits from AttributeDict.
441
442 It's now a pure dict subclass with properties for attribute
443 access to the relevant keys.
444
445 - The repr's now outputs how the sequence would like imperatively:
446
447 .. code-block:: pycon
448
449 >>> from celery import chord
450
451 >>> (chord([add.s(i, i) for i in xrange(10)], xsum.s())
452 | pow.s(2))
453 tasks.xsum([tasks.add(0, 0),
454 tasks.add(1, 1),
455 tasks.add(2, 2),
456 tasks.add(3, 3),
457 tasks.add(4, 4),
458 tasks.add(5, 5),
459 tasks.add(6, 6),
460 tasks.add(7, 7),
461 tasks.add(8, 8),
462 tasks.add(9, 9)]) | tasks.pow(2)
463
464 New remote control commands
465 ---------------------------
466
467 These commands were previously experimental, but they've proven
468 stable and is now documented as part of the official API.
469
470 - :control:`add_consumer`/:control:`cancel_consumer`
471
472 Tells workers to consume from a new queue, or cancel consuming from a
473 queue. This command has also been changed so that the worker remembers
474 the queues added, so that the change will persist even if
475 the connection is re-connected.
476
477 These commands are available programmatically as
478 :meth:`@control.add_consumer` / :meth:`@control.cancel_consumer`:
479
480 .. code-block:: pycon
481
482 >>> celery.control.add_consumer(queue_name,
483 ... destination=['w1.example.com'])
484 >>> celery.control.cancel_consumer(queue_name,
485 ... destination=['w1.example.com'])
486
487 or using the :program:`celery control` command:
488
489 .. code-block:: console
490
491 $ celery control -d w1.example.com add_consumer queue
492 $ celery control -d w1.example.com cancel_consumer queue
493
494 .. note::
495
496 Remember that a control command without *destination* will be
497 sent to **all workers**.
498
499 - :control:`autoscale`
500
501 Tells workers with ``--autoscale`` enabled to change autoscale
502 max/min concurrency settings.
503
504 This command is available programmatically as :meth:`@control.autoscale`:
505
506 .. code-block:: pycon
507
508 >>> celery.control.autoscale(max=10, min=5,
509 ... destination=['w1.example.com'])
510
511 or using the :program:`celery control` command:
512
513 .. code-block:: console
514
515 $ celery control -d w1.example.com autoscale 10 5
516
517 - :control:`pool_grow`/:control:`pool_shrink`
518
519 Tells workers to add or remove pool processes.
520
521 These commands are available programmatically as
522 :meth:`@control.pool_grow` / :meth:`@control.pool_shrink`:
523
524 .. code-block:: pycon
525
526 >>> celery.control.pool_grow(2, destination=['w1.example.com'])
527 >>> celery.control.pool_shrink(2, destination=['w1.example.com'])
528
529 or using the :program:`celery control` command:
530
531 .. code-block:: console
532
533 $ celery control -d w1.example.com pool_grow 2
534 $ celery control -d w1.example.com pool_shrink 2
535
536 - :program:`celery control` now supports :control:`rate_limit` and
537 :control:`time_limit` commands.
538
539 See ``celery control --help`` for details.
540
541 Crontab now supports Day of Month, and Month of Year arguments
542 --------------------------------------------------------------
543
544 See the updated list of examples at :ref:`beat-crontab`.
545
546 Immutable subtasks
547 ------------------
548
549 ``subtask``'s can now be immutable, which means that the arguments
550 won't be modified when calling callbacks:
551
552 .. code-block:: pycon
553
554 >>> chain(add.s(2, 2), clear_static_electricity.si())
555
556 means it'll not receive the argument of the parent task,
557 and ``.si()`` is a shortcut to:
558
559 .. code-block:: pycon
560
561 >>> clear_static_electricity.subtask(immutable=True)
562
563 Logging Improvements
564 --------------------
565
566 Logging support now conforms better with best practices.
567
568 - Classes used by the worker no longer uses app.get_default_logger, but uses
569 `celery.utils.log.get_logger` which simply gets the logger not setting the
570 level, and adds a NullHandler.
571
572 - Loggers are no longer passed around, instead every module using logging
573 defines a module global logger that's used throughout.
574
575 - All loggers inherit from a common logger called "celery".
576
577 - Before ``task.get_logger`` would setup a new logger for every task,
578 and even set the log level. This is no longer the case.
579
580 - Instead all task loggers now inherit from a common "celery.task" logger
581 that's set up when programs call `setup_logging_subsystem`.
582
583 - Instead of using LoggerAdapter to augment the formatter with
584 the task_id and task_name field, the task base logger now use
585 a special formatter adding these values at run-time from the
586 currently executing task.
587
588 - In fact, ``task.get_logger`` is no longer recommended, it is better
589 to add a module-level logger to your tasks module.
590
591 For example, like this:
592
593 .. code-block:: python
594
595 from celery.utils.log import get_task_logger
596
597 logger = get_task_logger(__name__)
598
599 @celery.task
600 def add(x, y):
601 logger.debug('Adding %r + %r' % (x, y))
602 return x + y
603
604 The resulting logger will then inherit from the ``"celery.task"`` logger
605 so that the current task name and id is included in logging output.
606
607 - Redirected output from stdout/stderr is now logged to a "celery.redirected"
608 logger.
609
610 - In addition a few warnings.warn have been replaced with logger.warn.
611
612 - Now avoids the 'no handlers for logger multiprocessing' warning
613
614 Task registry no longer global
615 ------------------------------
616
617 Every Celery instance now has its own task registry.
618
619 You can make apps share registries by specifying it:
620
621 .. code-block:: pycon
622
623 >>> app1 = Celery()
624 >>> app2 = Celery(tasks=app1.tasks)
625
626 Note that tasks are shared between registries by default, so that
627 tasks will be added to every subsequently created task registry.
628 As an alternative tasks can be private to specific task registries
629 by setting the ``shared`` argument to the ``@task`` decorator:
630
631 .. code-block:: python
632
633 @celery.task(shared=False)
634 def add(x, y):
635 return x + y
636
637
638 Abstract tasks are now lazily bound
639 -----------------------------------
640
641 The :class:`~celery.task.Task` class is no longer bound to an app
642 by default, it will first be bound (and configured) when
643 a concrete subclass is created.
644
645 This means that you can safely import and make task base classes,
646 without also initializing the app environment:
647
648 .. code-block:: python
649
650 from celery.task import Task
651
652 class DebugTask(Task):
653 abstract = True
654
655 def __call__(self, *args, **kwargs):
656 print('CALLING %r' % (self,))
657 return self.run(*args, **kwargs)
658
659 .. code-block:: pycon
660
661 >>> DebugTask
662 <unbound DebugTask>
663
664 >>> @celery1.task(base=DebugTask)
665 ... def add(x, y):
666 ... return x + y
667 >>> add.__class__
668 <class add of <Celery default:0x101510d10>>
669
670
671 Lazy task decorators
672 --------------------
673
674 The ``@task`` decorator is now lazy when used with custom apps.
675
676 That is, if ``accept_magic_kwargs`` is enabled (her by called "compat mode"), the task
677 decorator executes inline like before, however for custom apps the @task
678 decorator now returns a special PromiseProxy object that's only evaluated
679 on access.
680
681 All promises will be evaluated when :meth:`@finalize` is called, or implicitly
682 when the task registry is first used.
683
684
685 Smart `--app` option
686 --------------------
687
688 The :option:`--app <celery --app>` option now 'auto-detects'
689
690 - If the provided path is a module it tries to get an
691 attribute named 'celery'.
692
693 - If the provided path is a package it tries
694 to import a sub module named celery',
695 and get the celery attribute from that module.
696
697 For example, if you have a project named ``proj`` where the
698 celery app is located in ``from proj.celery import app``,
699 then the following will be equivalent:
700
701 .. code-block:: console
702
703 $ celery worker --app=proj
704 $ celery worker --app=proj.celery:
705 $ celery worker --app=proj.celery:app
706
707 In Other News
708 -------------
709
710 - New :setting:`CELERYD_WORKER_LOST_WAIT` to control the timeout in
711 seconds before :exc:`billiard.WorkerLostError` is raised
712 when a worker can't be signaled (Issue #595).
713
714 Contributed by Brendon Crawford.
715
716 - Redis event monitor queues are now automatically deleted (Issue #436).
717
718 - App instance factory methods have been converted to be cached
719 descriptors that creates a new subclass on access.
720
721 For example, this means that ``app.Worker`` is an actual class
722 and will work as expected when:
723
724 .. code-block:: python
725
726 class Worker(app.Worker):
727 ...
728
729 - New signal: :signal:`task_success`.
730
731 - Multiprocessing logs are now only emitted if the :envvar:`MP_LOG`
732 environment variable is set.
733
734 - The Celery instance can now be created with a broker URL
735
736 .. code-block:: python
737
738 app = Celery(broker='redis://')
739
740 - Result backends can now be set using a URL
741
742 Currently only supported by redis. Example use:
743
744 .. code-block:: python
745
746 CELERY_RESULT_BACKEND = 'redis://localhost/1'
747
748 - Heartbeat frequency now every 5s, and frequency sent with event
749
750 The heartbeat frequency is now available in the worker event messages,
751 so that clients can decide when to consider workers offline based on
752 this value.
753
754 - Module celery.actors has been removed, and will be part of cl instead.
755
756 - Introduces new ``celery`` command, which is an entry-point for all other
757 commands.
758
759 The main for this command can be run by calling ``celery.start()``.
760
761 - Annotations now supports decorators if the key starts with '@'.
762
763 For example:
764
765 .. code-block:: python
766
767 def debug_args(fun):
768
769 @wraps(fun)
770 def _inner(*args, **kwargs):
771 print('ARGS: %r' % (args,))
772 return _inner
773
774 CELERY_ANNOTATIONS = {
775 'tasks.add': {'@__call__': debug_args},
776 }
777
778 Also tasks are now always bound by class so that
779 annotated methods end up being bound.
780
781 - Bug-report now available as a command and broadcast command
782
783 - Get it from a Python REPL:
784
785 .. code-block:: pycon
786
787 >>> import celery
788 >>> print(celery.bugreport())
789
790 - Using the ``celery`` command line program:
791
792 .. code-block:: console
793
794 $ celery report
795
796 - Get it from remote workers:
797
798 .. code-block:: console
799
800 $ celery inspect report
801
802 - Module ``celery.log`` moved to :mod:`celery.app.log`.
803
804 - Module ``celery.task.control`` moved to :mod:`celery.app.control`.
805
806 - New signal: :signal:`task_revoked`
807
808 Sent in the main process when the task is revoked or terminated.
809
810 - ``AsyncResult.task_id`` renamed to ``AsyncResult.id``
811
812 - ``TasksetResult.taskset_id`` renamed to ``.id``
813
814 - ``xmap(task, sequence)`` and ``xstarmap(task, sequence)``
815
816 Returns a list of the results applying the task function to every item
817 in the sequence.
818
819 Example:
820
821 .. code-block:: pycon
822
823 >>> from celery import xstarmap
824
825 >>> xstarmap(add, zip(range(10), range(10)).apply_async()
826 [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
827
828 - ``chunks(task, sequence, chunksize)``
829
830 - ``group.skew(start=, stop=, step=)``
831
832 Skew will skew the countdown for the individual tasks in a group -- for
833 example with this group:
834
835 .. code-block:: pycon
836
837 >>> g = group(add.s(i, i) for i in xrange(10))
838
839 Skewing the tasks from 0 seconds to 10 seconds:
840
841 .. code-block:: pycon
842
843 >>> g.skew(stop=10)
844
845 Will have the first task execute in 0 seconds, the second in 1 second,
846 the third in 2 seconds and so on.
847
848 - 99% test Coverage
849
850 - :setting:`CELERY_QUEUES` can now be a list/tuple of :class:`~kombu.Queue`
851 instances.
852
853 Internally :attr:`@amqp.queues` is now a mapping of name/Queue instances,
854 instead of converting on the fly.
855
856 - Can now specify connection for :class:`@control.inspect`.
857
858 .. code-block:: python
859
860 from kombu import Connection
861
862 i = celery.control.inspect(connection=Connection('redis://'))
863 i.active_queues()
864
865 - :setting:`CELERY_FORCE_EXECV` is now enabled by default.
866
867 If the old behavior is wanted the setting can be set to False,
868 or the new `--no-execv` option to :program:`celery worker`.
869
870 - Deprecated module ``celery.conf`` has been removed.
871
872 - The :setting:`CELERY_TIMEZONE` now always require the :pypi:`pytz`
873 library to be installed (except if the timezone is set to `UTC`).
874
875 - The Tokyo Tyrant backend has been removed and is no longer supported.
876
877 - Now uses :func:`~kombu.common.maybe_declare` to cache queue declarations.
878
879 - There's no longer a global default for the
880 :setting:`CELERYBEAT_MAX_LOOP_INTERVAL` setting, it is instead
881 set by individual schedulers.
882
883 - Worker: now truncates very long message bodies in error reports.
884
885 - No longer deep-copies exceptions when trying to serialize errors.
886
887 - :envvar:`CELERY_BENCH` environment variable, will now also list
888 memory usage statistics at worker shutdown.
889
890 - Worker: now only ever use a single timer for all timing needs,
891 and instead set different priorities.
892
893 - An exceptions arguments are now safely pickled
894
895 Contributed by Matt Long.
896
897 - Worker/Beat no longer logs the start-up banner.
898
899 Previously it would be logged with severity warning,
900 now it's only written to stdout.
901
902 - The ``contrib/`` directory in the distribution has been renamed to
903 ``extra/``.
904
905 - New signal: :signal:`task_revoked`
906
907 - :mod:`celery.contrib.migrate`: Many improvements, including;
908 filtering, queue migration, and support for acking messages on the broker
909 migrating from.
910
911 Contributed by John Watson.
912
913 - Worker: Prefetch count increments are now optimized and grouped together.
914
915 - Worker: No longer calls ``consume`` on the remote control command queue
916 twice.
917
918 Probably didn't cause any problems, but was unnecessary.
919
920 Internals
921 ---------
922
923 - ``app.broker_connection`` is now ``app.connection``
924
925 Both names still work.
926
927 - Compatibility modules are now generated dynamically upon use.
928
929 These modules are ``celery.messaging``, ``celery.log``,
930 ``celery.decorators`` and ``celery.registry``.
931
932 - :mod:`celery.utils` refactored into multiple modules:
933
934 :mod:`celery.utils.text`
935 :mod:`celery.utils.imports`
936 :mod:`celery.utils.functional`
937
938 - Now using :mod:`kombu.utils.encoding` instead of
939 :mod:`celery.utils.encoding`.
940
941 - Renamed module ``celery.routes`` -> :mod:`celery.app.routes`.
942
943 - Renamed package ``celery.db`` -> :mod:`celery.backends.database`.
944
945 - Renamed module ``celery.abstract`` -> :mod:`celery.worker.bootsteps`.
946
947 - Command line docs are now parsed from the module docstrings.
948
949 - Test suite directory has been reorganized.
950
951 - :program:`setup.py` now reads docs from the :file:`requirements/` directory.
952
953 - Celery commands no longer wraps output (Issue #700).
954
955 Contributed by Thomas Johansson.
956
957 .. _v300-experimental:
958
959 Experimental
960 ============
961
962 :mod:`celery.contrib.methods`: Task decorator for methods
963 ----------------------------------------------------------
964
965 This is an experimental module containing a task
966 decorator, and a task decorator filter, that can be used
967 to create tasks out of methods::
968
969 from celery.contrib.methods import task_method
970
971 class Counter(object):
972
973 def __init__(self):
974 self.value = 1
975
976 @celery.task(name='Counter.increment', filter=task_method)
977 def increment(self, n=1):
978 self.value += 1
979 return self.value
980
981
982 See :mod:`celery.contrib.methods` for more information.
983
984 .. _v300-unscheduled-removals:
985
986 Unscheduled Removals
987 ====================
988
989 Usually we don't make backward incompatible removals,
990 but these removals should have no major effect.
991
992 - The following settings have been renamed:
993
994 - ``CELERYD_ETA_SCHEDULER`` -> ``CELERYD_TIMER``
995 - ``CELERYD_ETA_SCHEDULER_PRECISION`` -> ``CELERYD_TIMER_PRECISION``
996
997 .. _v300-deprecations:
998
999 Deprecation Time-line Changes
1000 =============================
1001
1002 See the :ref:`deprecation-timeline`.
1003
1004 - The ``celery.backends.pyredis`` compat module has been removed.
1005
1006 Use :mod:`celery.backends.redis` instead!
1007
1008 - The following undocumented API's has been moved:
1009
1010 - ``control.inspect.add_consumer`` -> :meth:`@control.add_consumer`.
1011 - ``control.inspect.cancel_consumer`` -> :meth:`@control.cancel_consumer`.
1012 - ``control.inspect.enable_events`` -> :meth:`@control.enable_events`.
1013 - ``control.inspect.disable_events`` -> :meth:`@control.disable_events`.
1014
1015 This way ``inspect()`` is only used for commands that don't
1016 modify anything, while idempotent control commands that make changes
1017 are on the control objects.
1018
1019 Fixes
1020 =====
1021
1022 - Retry SQLAlchemy backend operations on DatabaseError/OperationalError
1023 (Issue #634)
1024
1025 - Tasks that called ``retry`` wasn't acknowledged if acks late was enabled
1026
1027 Fix contributed by David Markey.
1028
1029 - The message priority argument wasn't properly propagated to Kombu
1030 (Issue #708).
1031
1032 Fix contributed by Eran Rundstein