Debian Codegraph @

docs/history/changelog-2.1.rst

raw
1 .. _changelog-2.1:
2
3 ===============================
4 Change history for Celery 2.1
5 ===============================
6
7 .. contents::
8 :local:
9
10 .. _version-2.1.4:
11
12 2.1.4
13 =====
14 :release-date: 2010-12-03 12:00 p.m. CEST
15 :release-by: Ask Solem
16
17 .. _v214-fixes:
18
19 Fixes
20 -----
21
22 * Execution options to `apply_async` now takes precedence over options
23 returned by active routers. This was a regression introduced recently
24 (Issue #244).
25
26 * curses monitor: Long arguments are now truncated so curses
27 doesn't crash with out of bounds errors (Issue #235).
28
29 * multi: Channel errors occurring while handling control commands no
30 longer crash the worker but are instead logged with severity error.
31
32 * SQLAlchemy database backend: Fixed a race condition occurring when
33 the client wrote the pending state. Just like the Django database backend,
34 it does no longer save the pending state (Issue #261 + Issue #262).
35
36 * Error email body now uses `repr(exception)` instead of `str(exception)`,
37 as the latter could result in Unicode decode errors (Issue #245).
38
39 * Error email timeout value is now configurable by using the
40 :setting:`EMAIL_TIMEOUT` setting.
41
42 * `celeryev`: Now works on Windows (but the curses monitor won't work without
43 having curses).
44
45 * Unit test output no longer emits non-standard characters.
46
47 * worker: The broadcast consumer is now closed if the connection is reset.
48
49 * worker: Now properly handles errors occurring while trying to acknowledge
50 the message.
51
52 * `TaskRequest.on_failure` now encodes traceback using the current file-system
53 encoding (Issue #286).
54
55 * `EagerResult` can now be pickled (Issue #288).
56
57 .. _v214-documentation:
58
59 Documentation
60 -------------
61
62 * Adding :ref:`contributing`.
63
64 * Added :ref:`guide-optimizing`.
65
66 * Added :ref:`faq-security` section to the FAQ.
67
68 .. _version-2.1.3:
69
70 2.1.3
71 =====
72 :release-date: 2010-11-09 05:00 p.m. CEST
73 :release-by: Ask Solem
74
75 .. _v213-fixes:
76
77 * Fixed deadlocks in `timer2` which could lead to `djcelerymon`/`celeryev -c`
78 hanging.
79
80 * `EventReceiver`: now sends heartbeat request to find workers.
81
82 This means :program:`celeryev` and friends finds workers immediately
83 at start-up.
84
85 * ``celeryev`` curses monitor: Set screen_delay to 10ms, so the screen
86 refreshes more often.
87
88 * Fixed pickling errors when pickling :class:`AsyncResult` on older Python
89 versions.
90
91 * worker: prefetch count was decremented by ETA tasks even if there
92 were no active prefetch limits.
93
94
95 .. _version-2.1.2:
96
97 2.1.2
98 =====
99 :release-data: TBA
100
101 .. _v212-fixes:
102
103 Fixes
104 -----
105
106 * worker: Now sends the :event:`task-retried` event for retried tasks.
107
108 * worker: Now honors ignore result for
109 :exc:`~@WorkerLostError` and timeout errors.
110
111 * ``celerybeat``: Fixed :exc:`UnboundLocalError` in ``celerybeat`` logging
112 when using logging setup signals.
113
114 * worker: All log messages now includes `exc_info`.
115
116 .. _version-2.1.1:
117
118 2.1.1
119 =====
120 :release-date: 2010-10-14 02:00 p.m. CEST
121 :release-by: Ask Solem
122
123 .. _v211-fixes:
124
125 Fixes
126 -----
127
128 * Now working on Windows again.
129
130 Removed dependency on the :mod:`pwd`/:mod:`grp` modules.
131
132 * snapshots: Fixed race condition leading to loss of events.
133
134 * worker: Reject tasks with an ETA that cannot be converted to a time stamp.
135
136 See issue #209
137
138 * concurrency.processes.pool: The semaphore was released twice for each task
139 (both at ACK and result ready).
140
141 This has been fixed, and it is now released only once per task.
142
143 * docs/configuration: Fixed typo `CELERYD_TASK_SOFT_TIME_LIMIT` ->
144 :setting:`CELERYD_TASK_SOFT_TIME_LIMIT`.
145
146 See issue #214
147
148 * control command `dump_scheduled`: was using old .info attribute
149
150 * multi: Fixed `set changed size during iteration` bug
151 occurring in the restart command.
152
153 * worker: Accidentally tried to use additional command-line arguments.
154
155 This would lead to an error like:
156
157 `got multiple values for keyword argument 'concurrency'`.
158
159 Additional command-line arguments are now ignored, and doesn't
160 produce this error. However -- we do reserve the right to use
161 positional arguments in the future, so please don't depend on this
162 behavior.
163
164 * ``celerybeat``: Now respects routers and task execution options again.
165
166 * ``celerybeat``: Now reuses the publisher instead of the connection.
167
168 * Cache result backend: Using :class:`float` as the expires argument
169 to `cache.set` is deprecated by the Memcached libraries,
170 so we now automatically cast to :class:`int`.
171
172 * unit tests: No longer emits logging and warnings in test output.
173
174 .. _v211-news:
175
176 News
177 ----
178
179 * Now depends on carrot version 0.10.7.
180
181 * Added :setting:`CELERY_REDIRECT_STDOUTS`, and
182 :setting:`CELERYD_REDIRECT_STDOUTS_LEVEL` settings.
183
184 :setting:`CELERY_REDIRECT_STDOUTS` is used by the worker and
185 beat. All output to `stdout` and `stderr` will be
186 redirected to the current logger if enabled.
187
188 :setting:`CELERY_REDIRECT_STDOUTS_LEVEL` decides the log level used and is
189 :const:`WARNING` by default.
190
191 * Added :setting:`CELERYBEAT_SCHEDULER` setting.
192
193 This setting is used to define the default for the -S option to
194 :program:`celerybeat`.
195
196 Example:
197
198 .. code-block:: python
199
200 CELERYBEAT_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler'
201
202 * Added Task.expires: Used to set default expiry time for tasks.
203
204 * New remote control commands: `add_consumer` and `cancel_consumer`.
205
206 .. method:: add_consumer(queue, exchange, exchange_type, routing_key,
207 \*\*options)
208 :module:
209
210 Tells the worker to declare and consume from the specified
211 declaration.
212
213 .. method:: cancel_consumer(queue_name)
214 :module:
215
216 Tells the worker to stop consuming from queue (by queue name).
217
218
219 Commands also added to :program:`celeryctl` and
220 :class:`~celery.task.control.inspect`.
221
222
223 Example using ``celeryctl`` to start consuming from queue "queue", in
224 exchange "exchange", of type "direct" using binding key "key":
225
226 .. code-block:: console
227
228 $ celeryctl inspect add_consumer queue exchange direct key
229 $ celeryctl inspect cancel_consumer queue
230
231 See :ref:`monitoring-control` for more information about the
232 :program:`celeryctl` program.
233
234
235 Another example using :class:`~celery.task.control.inspect`:
236
237 .. code-block:: pycon
238
239 >>> from celery.task.control import inspect
240 >>> inspect.add_consumer(queue='queue', exchange='exchange',
241 ... exchange_type='direct',
242 ... routing_key='key',
243 ... durable=False,
244 ... auto_delete=True)
245
246 >>> inspect.cancel_consumer('queue')
247
248 * ``celerybeat``: Now logs the traceback if a message can't be sent.
249
250 * ``celerybeat``: Now enables a default socket timeout of 30 seconds.
251
252 * ``README``/introduction/homepage: Added link to `Flask-Celery`_.
253
254 .. _`Flask-Celery`: https://github.com/ask/flask-celery
255
256 .. _version-2.1.0:
257
258 2.1.0
259 =====
260 :release-date: 2010-10-08 12:00 p.m. CEST
261 :release-by: Ask Solem
262
263 .. _v210-important:
264
265 Important Notes
266 ---------------
267
268 * Celery is now following the versioning semantics defined by `semver`_.
269
270 This means we're no longer allowed to use odd/even versioning semantics
271 By our previous versioning scheme this stable release should've
272 been version 2.2.
273
274 .. _`semver`: http://semver.org
275
276 * Now depends on Carrot 0.10.7.
277
278 * No longer depends on SQLAlchemy, this needs to be installed separately
279 if the database result backend is used.
280
281 * :pypi:`django-celery` now comes with a monitor for the Django Admin
282 interface. This can also be used if you're not a Django user.
283 (Update: Django-Admin monitor has been replaced with Flower, see the
284 Monitoring guide).
285
286 * If you get an error after upgrading saying:
287 `AttributeError: 'module' object has no attribute 'system'`,
288
289 Then this is because the `celery.platform` module has been
290 renamed to `celery.platforms` to not collide with the built-in
291 :mod:`platform` module.
292
293 You have to remove the old :file:`platform.py` (and maybe
294 :file:`platform.pyc`) file from your previous Celery installation.
295
296 To do this use :program:`python` to find the location
297 of this module:
298
299 .. code-block:: console
300
301 $ python
302 >>> import celery.platform
303 >>> celery.platform
304 <module 'celery.platform' from '/opt/devel/celery/celery/platform.pyc'>
305
306 Here the compiled module is in :file:`/opt/devel/celery/celery/`,
307 to remove the offending files do:
308
309 .. code-block:: console
310
311 $ rm -f /opt/devel/celery/celery/platform.py*
312
313 .. _v210-news:
314
315 News
316 ----
317
318 * Added support for expiration of AMQP results (requires RabbitMQ 2.1.0)
319
320 The new configuration option :setting:`CELERY_AMQP_TASK_RESULT_EXPIRES`
321 sets the expiry time in seconds (can be int or float):
322
323 .. code-block:: python
324
325 CELERY_AMQP_TASK_RESULT_EXPIRES = 30 * 60 # 30 minutes.
326 CELERY_AMQP_TASK_RESULT_EXPIRES = 0.80 # 800 ms.
327
328 * ``celeryev``: Event Snapshots
329
330 If enabled, the worker sends messages about what the worker is doing.
331 These messages are called "events".
332 The events are used by real-time monitors to show what the
333 cluster is doing, but they're not very useful for monitoring
334 over a longer period of time. Snapshots
335 lets you take "pictures" of the clusters state at regular intervals.
336 This can then be stored in a database to generate statistics
337 with, or even monitoring over longer time periods.
338
339 :pypi:`django-celery` now comes with a Celery monitor for the Django
340 Admin interface. To use this you need to run the :pypi:`django-celery`
341 snapshot camera, which stores snapshots to the database at configurable
342 intervals.
343
344 To use the Django admin monitor you need to do the following:
345
346 1. Create the new database tables:
347
348 .. code-block:: console
349
350 $ python manage.py syncdb
351
352 2. Start the :pypi:`django-celery` snapshot camera:
353
354 .. code-block:: console
355
356 $ python manage.py celerycam
357
358 3. Open up the django admin to monitor your cluster.
359
360 The admin interface shows tasks, worker nodes, and even
361 lets you perform some actions, like revoking and rate limiting tasks,
362 and shutting down worker nodes.
363
364 There's also a Debian init.d script for :mod:`~celery.bin.events` available,
365 see :ref:`daemonizing` for more information.
366
367 New command-line arguments to ``celeryev``:
368
369 * :option:`celery events --camera`: Snapshot camera class to use.
370 * :option:`celery events --logfile`: Log file
371 * :option:`celery events --loglevel`: Log level
372 * :option:`celery events --maxrate`: Shutter rate limit.
373 * :option:`celery events --freq`: Shutter frequency
374
375 The :option:`--camera <celery events --camera>` argument is the name
376 of a class used to take snapshots with. It must support the interface
377 defined by :class:`celery.events.snapshot.Polaroid`.
378
379 Shutter frequency controls how often the camera thread wakes up,
380 while the rate limit controls how often it will actually take
381 a snapshot.
382 The rate limit can be an integer (snapshots/s), or a rate limit string
383 which has the same syntax as the task rate limit strings (`"200/m"`,
384 `"10/s"`, `"1/h",` etc).
385
386 For the Django camera case, this rate limit can be used to control
387 how often the snapshots are written to the database, and the frequency
388 used to control how often the thread wakes up to check if there's
389 anything new.
390
391 The rate limit is off by default, which means it will take a snapshot
392 for every :option:`--frequency <celery events --frequency>` seconds.
393
394 * :func:`~celery.task.control.broadcast`: Added callback argument, this can be
395 used to process replies immediately as they arrive.
396
397 * ``celeryctl``: New command line utility to manage and inspect worker nodes,
398 apply tasks and inspect the results of tasks.
399
400 .. seealso::
401
402 The :ref:`monitoring-control` section in the :ref:`guide`.
403
404 Some examples:
405
406 .. code-block:: console
407
408 $ celeryctl apply tasks.add -a '[2, 2]' --countdown=10
409
410 $ celeryctl inspect active
411 $ celeryctl inspect registered_tasks
412 $ celeryctl inspect scheduled
413 $ celeryctl inspect --help
414 $ celeryctl apply --help
415
416 * Added the ability to set an expiry date and time for tasks.
417
418 Example::
419
420 >>> # Task expires after one minute from now.
421 >>> task.apply_async(args, kwargs, expires=60)
422 >>> # Also supports datetime
423 >>> task.apply_async(args, kwargs,
424 ... expires=datetime.now() + timedelta(days=1)
425
426 When a worker receives a task that's been expired it will be
427 marked as revoked (:exc:`~@TaskRevokedError`).
428
429 * Changed the way logging is configured.
430
431 We now configure the root logger instead of only configuring
432 our custom logger. In addition we don't hijack
433 the multiprocessing logger anymore, but instead use a custom logger name
434 for different applications:
435
436 ===================================== =====================================
437 **Application** **Logger Name**
438 ===================================== =====================================
439 ``celeryd`` ``"celery"``
440 ``celerybeat`` ``"celery.beat"``
441 ``celeryev`` ``"celery.ev"``
442 ===================================== =====================================
443
444 This means that the `loglevel` and `logfile` arguments will
445 affect all registered loggers (even those from third-party libraries).
446 Unless you configure the loggers manually as shown below, that is.
447
448 *Users can choose to configure logging by subscribing to the
449 :signal:`~celery.signals.setup_logging` signal:*
450
451 .. code-block:: python
452
453 from logging.config import fileConfig
454 from celery import signals
455
456 @signals.setup_logging.connect
457 def setup_logging(**kwargs):
458 fileConfig('logging.conf')
459
460 If there are no receivers for this signal, the logging subsystem
461 will be configured using the
462 :option:`--loglevel <celery worker --loglevel>`/
463 :option:`--logfile <celery worker --logfile>`
464 arguments, this will be used for *all defined loggers*.
465
466 Remember that the worker also redirects stdout and stderr
467 to the Celery logger, if manually configure logging
468 you also need to redirect the standard outs manually:
469
470 .. code-block:: python
471
472 from logging.config import fileConfig
473 from celery import log
474
475 def setup_logging(**kwargs):
476 import logging
477 fileConfig('logging.conf')
478 stdouts = logging.getLogger('mystdoutslogger')
479 log.redirect_stdouts_to_logger(stdouts, loglevel=logging.WARNING)
480
481 * worker Added command line option
482 :option:`--include <celery worker --include>`:
483
484 A comma separated list of (task) modules to be imported.
485
486 Example:
487
488 .. code-block:: console
489
490 $ celeryd -I app1.tasks,app2.tasks
491
492 * worker: now emits a warning if running as the root user (euid is 0).
493
494 * :func:`celery.messaging.establish_connection`: Ability to override defaults
495 used using keyword argument "defaults".
496
497 * worker: Now uses `multiprocessing.freeze_support()` so that it should work
498 with **py2exe**, **PyInstaller**, **cx_Freeze**, etc.
499
500 * worker: Now includes more meta-data for the :state:`STARTED` state: PID and
501 host name of the worker that started the task.
502
503 See issue #181
504
505 * subtask: Merge additional keyword arguments to `subtask()` into task keyword
506 arguments.
507
508 For example:
509
510 .. code-block:: pycon
511
512 >>> s = subtask((1, 2), {'foo': 'bar'}, baz=1)
513 >>> s.args
514 (1, 2)
515 >>> s.kwargs
516 {'foo': 'bar', 'baz': 1}
517
518 See issue #182.
519
520 * worker: Now emits a warning if there's already a worker node using the same
521 name running on the same virtual host.
522
523 * AMQP result backend: Sending of results are now retried if the connection
524 is down.
525
526 * AMQP result backend: `result.get()`: Wait for next state if state isn't
527 in :data:`~celery.states.READY_STATES`.
528
529 * TaskSetResult now supports subscription.
530
531 ::
532
533 >>> res = TaskSet(tasks).apply_async()
534 >>> res[0].get()
535
536 * Added `Task.send_error_emails` + `Task.error_whitelist`, so these can
537 be configured per task instead of just by the global setting.
538
539 * Added `Task.store_errors_even_if_ignored`, so it can be changed per Task,
540 not just by the global setting.
541
542 * The Crontab scheduler no longer wakes up every second, but implements
543 `remaining_estimate` (*Optimization*).
544
545 * worker: Store :state:`FAILURE` result if the
546 :exc:`~@WorkerLostError` exception occurs (worker process
547 disappeared).
548
549 * worker: Store :state:`FAILURE` result if one of the `*TimeLimitExceeded`
550 exceptions occurs.
551
552 * Refactored the periodic task responsible for cleaning up results.
553
554 * The backend cleanup task is now only added to the schedule if
555 :setting:`CELERY_TASK_RESULT_EXPIRES` is set.
556
557 * If the schedule already contains a periodic task named
558 "celery.backend_cleanup" it won't change it, so the behavior of the
559 backend cleanup task can be easily changed.
560
561 * The task is now run every day at 4:00 AM, rather than every day since
562 the first time it was run (using Crontab schedule instead of
563 `run_every`)
564
565 * Renamed `celery.task.builtins.DeleteExpiredTaskMetaTask`
566 -> :class:`celery.task.builtins.backend_cleanup`
567
568 * The task itself has been renamed from "celery.delete_expired_task_meta"
569 to "celery.backend_cleanup"
570
571 See issue #134.
572
573 * Implemented `AsyncResult.forget` for SQLAlchemy/Memcached/Redis/Tokyo Tyrant
574 backends (forget and remove task result).
575
576 See issue #184.
577
578 * :meth:`TaskSetResult.join <celery.result.TaskSetResult.join>`:
579 Added 'propagate=True' argument.
580
581 When set to :const:`False` exceptions occurring in subtasks will
582 not be re-raised.
583
584 * Added `Task.update_state(task_id, state, meta)`
585 as a shortcut to `task.backend.store_result(task_id, meta, state)`.
586
587 The backend interface is "private" and the terminology outdated,
588 so better to move this to :class:`~celery.task.base.Task` so it can be
589 used.
590
591 * timer2: Set `self.running=False` in
592 :meth:`~celery.utils.timer2.Timer.stop` so it won't try to join again on
593 subsequent calls to `stop()`.
594
595 * Log colors are now disabled by default on Windows.
596
597 * `celery.platform` renamed to :mod:`celery.platforms`, so it doesn't
598 collide with the built-in :mod:`platform` module.
599
600 * Exceptions occurring in Mediator+Pool callbacks are now caught and logged
601 instead of taking down the worker.
602
603 * Redis result backend: Now supports result expiration using the Redis
604 `EXPIRE` command.
605
606 * unit tests: Don't leave threads running at tear down.
607
608 * worker: Task results shown in logs are now truncated to 46 chars.
609
610 * `Task.__name__` is now an alias to `self.__class__.__name__`.
611 This way tasks introspects more like regular functions.
612
613 * `Task.retry`: Now raises :exc:`TypeError` if kwargs argument is empty.
614
615 See issue #164.
616
617 * ``timedelta_seconds``: Use ``timedelta.total_seconds`` if running on Python 2.7
618
619 * :class:`~kombu.utils.limits.TokenBucket`: Generic Token Bucket algorithm
620
621 * :mod:`celery.events.state`: Recording of cluster state can now
622 be paused and resumed, including support for buffering.
623
624
625 .. method:: State.freeze(buffer=True)
626
627 Pauses recording of the stream.
628
629 If `buffer` is true, events received while being frozen will be
630 buffered, and may be replayed later.
631
632 .. method:: State.thaw(replay=True)
633
634 Resumes recording of the stream.
635
636 If `replay` is true, then the recorded buffer will be applied.
637
638 .. method:: State.freeze_while(fun)
639
640 With a function to apply, freezes the stream before,
641 and replays the buffer after the function returns.
642
643 * :meth:`EventReceiver.capture <celery.events.EventReceiver.capture>`
644 Now supports a timeout keyword argument.
645
646 * worker: The mediator thread is now disabled if
647 :setting:`CELERY_RATE_LIMITS` is enabled, and tasks are directly sent to the
648 pool without going through the ready queue (*Optimization*).
649
650 .. _v210-fixes:
651
652 Fixes
653 -----
654
655 * Pool: Process timed out by `TimeoutHandler` must be joined by the Supervisor,
656 so don't remove it from the internal process list.
657
658 See issue #192.
659
660 * `TaskPublisher.delay_task` now supports exchange argument, so exchange can be
661 overridden when sending tasks in bulk using the same publisher
662
663 See issue #187.
664
665 * the worker no longer marks tasks as revoked if :setting:`CELERY_IGNORE_RESULT`
666 is enabled.
667
668 See issue #207.
669
670 * AMQP Result backend: Fixed bug with `result.get()` if
671 :setting:`CELERY_TRACK_STARTED` enabled.
672
673 `result.get()` would stop consuming after receiving the
674 :state:`STARTED` state.
675
676 * Fixed bug where new processes created by the pool supervisor becomes stuck
677 while reading from the task Queue.
678
679 See http://bugs.python.org/issue10037
680
681 * Fixed timing issue when declaring the remote control command reply queue
682
683 This issue could result in replies being lost, but have now been fixed.
684
685 * Backward compatible `LoggerAdapter` implementation: Now works for Python 2.4.
686
687 Also added support for several new methods:
688 `fatal`, `makeRecord`, `_log`, `log`, `isEnabledFor`,
689 `addHandler`, `removeHandler`.
690
691 .. _v210-experimental:
692
693 Experimental
694 ------------
695
696 * multi: Added daemonization support.
697
698 multi can now be used to start, stop and restart worker nodes:
699
700 .. code-block:: console
701
702 $ celeryd-multi start jerry elaine george kramer
703
704 This also creates PID files and log files (:file:`[email protected]`,
705 ..., :file:`[email protected]`. To specify a location for these files
706 use the `--pidfile` and `--logfile` arguments with the `%n`
707 format:
708
709 .. code-block:: console
710
711 $ celeryd-multi start jerry elaine george kramer \
712 --logfile=/var/log/celeryd@%n.log \
713 --pidfile=/var/run/celeryd@%n.pid
714
715 Stopping:
716
717 .. code-block:: console
718
719 $ celeryd-multi stop jerry elaine george kramer
720
721 Restarting. The nodes will be restarted one by one as the old ones
722 are shutdown:
723
724 .. code-block:: console
725
726 $ celeryd-multi restart jerry elaine george kramer
727
728 Killing the nodes (**WARNING**: Will discard currently executing tasks):
729
730 .. code-block:: console
731
732 $ celeryd-multi kill jerry elaine george kramer
733
734 See `celeryd-multi help` for help.
735
736 * multi: `start` command renamed to `show`.
737
738 `celeryd-multi start` will now actually start and detach worker nodes.
739 To just generate the commands you have to use `celeryd-multi show`.
740
741 * worker: Added `--pidfile` argument.
742
743 The worker will write its pid when it starts. The worker will
744 not be started if this file exists and the pid contained is still alive.
745
746 * Added generic init.d script using `celeryd-multi`
747
748 https://github.com/celery/celery/tree/master/extra/generic-init.d/celeryd
749
750 .. _v210-documentation:
751
752 Documentation
753 -------------
754
755 * Added User guide section: Monitoring
756
757 * Added user guide section: Periodic Tasks
758
759 Moved from `getting-started/periodic-tasks` and updated.
760
761 * tutorials/external moved to new section: "community".
762
763 * References has been added to all sections in the documentation.
764
765 This makes it easier to link between documents.
766
767