forked from celery/celery
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathChangelog
3265 lines (2143 loc) · 103 KB
/
Changelog
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
================
Change history
================
.. contents::
:local:
.. _version-2.1.0:
2.1.0
=====
:release-date: 2010-10-08 12:00 PM CEST
.. _v210-important:
Important Notes
---------------
* Celery is now following the versioning semantics defined by `semver`_.
This means we are no longer allowed to use odd/even versioning semantics
By our previous versioning scheme this stable release should have
been version 2.2.
.. _`semver`: http://semver.org
* Now depends on Carrot 0.10.7.
* No longer depends on SQLAlchemy, this needs to be installed separately
if the database result backend is used.
* django-celery now comes with a monitor for the Django Admin interface.
This can also be used if you're not a Django user. See
:ref:`monitoring-django-admin` and :ref:`monitoring-nodjango` for more information.
* If you get an error after upgrading saying:
``AttributeError: 'module' object has no attribute 'system'``,
Then this is because the ``celery.platform`` module has been
renamed to ``celery.platforms`` to not collide with the built-in
:mod:`platform` module.
You have to remove the old :file:`platform.py` (and maybe
:file:`platform.pyc`) file from your previous Celery installation.
To do this use :program:`python` to find the location
of this module::
$ python
>>> import celery.platform
>>> celery.platform
<module 'celery.platform' from '/opt/devel/celery/celery/platform.pyc'>
Here the compiled module is in :file:`/opt/devel/celery/celery/`,
to remove the offending files do::
$ rm -f /opt/devel/celery/celery/platform.py*
.. _v210-news:
News
----
* Added support for expiration of AMQP results (requires RabbitMQ 2.1.0)
The new configuration option :setting:`CELERY_AMQP_TASK_RESULT_EXPIRES`
sets the expiry time in seconds (can be int or float):
.. code-block:: python
CELERY_AMQP_TASK_RESULT_EXPIRES = 30 * 60 # 30 mins
CELERY_AMQP_TASK_RESULT_EXPIRES = 0.80 # 800 ms
* celeryev: Event Snapshots
If enabled, :program:`celeryd` sends messages about what the worker is doing.
These messages are called "events".
The events are used by real-time monitors to show what the
cluster is doing, but they are not very useful for monitoring
over a longer period of time. Snapshots
lets you take "pictures" of the clusters state at regular intervals.
This can then be stored in a database to generate statistics
with, or even monitoring over longer time periods.
django-celery now comes with a Celery monitor for the Django
Admin interface. To use this you need to run the django-celery
snapshot camera, which stores snapshots to the database at configurable
intervals. See :ref:`monitoring-nodjango` for information about using
this monitor if you're not using Django.
To use the Django admin monitor you need to do the following:
1. Create the new database tables.
$ python manage.py syncdb
2. Start the django-celery snapshot camera::
$ python manage.py celerycam
3. Open up the django admin to monitor your cluster.
The admin interface shows tasks, worker nodes, and even
lets you perform some actions, like revoking and rate limiting tasks,
and shutting down worker nodes.
There's also a Debian init.d script for :mod:`~celery.bin.celeryev` available,
see :doc:`cookbook/daemonizing` for more information.
New command line argments to celeryev:
* :option:`-c|--camera`: Snapshot camera class to use.
* :option:`--logfile|-f`: Logfile
* :option:`--loglevel|-l`: Loglevel
* :option:`--maxrate|-r`: Shutter rate limit.
* :option:`--freq|-F`: Shutter frequency
The :option:`--camera` argument is the name of a class used to take
snapshots with. It must support the interface defined by
:class:`celery.events.snapshot.Polaroid`.
Shutter frequency controls how often the camera thread wakes up,
while the rate limit controls how often it will actually take
a snapshot.
The rate limit can be an integer (snapshots/s), or a rate limit string
which has the same syntax as the task rate limit strings (``"200/m"``,
``"10/s"``, ``"1/h",`` etc).
For the Django camera case, this rate limit can be used to control
how often the snapshots are written to the database, and the frequency
used to control how often the thread wakes up to check if there's
anything new.
The rate limit is off by default, which means it will take a snapshot
for every :option:`--frequency` seconds.
.. seealso::
:ref:`monitoring-django-admin` and :ref:`monitoring-snapshots`.
* :func:`~celery.task.control.broadcast`: Added callback argument, this can be
used to process replies immediately as they arrive.
* celeryctl: New command-line utility to manage and inspect worker nodes,
apply tasks and inspect the results of tasks.
.. seealso::
The :ref:`monitoring-celeryctl` section in the :ref:`guide`.
Some examples::
$ celeryctl apply tasks.add -a '[2, 2]' --countdown=10
$ celeryctl inspect active
$ celeryctl inspect registered_tasks
$ celeryctl inspect scheduled
$ celeryctl inspect --help
$ celeryctl apply --help
* Added the ability to set an expiry date and time for tasks.
Example::
>>> # Task expires after one minute from now.
>>> task.apply_async(args, kwargs, expires=60)
>>> # Also supports datetime
>>> task.apply_async(args, kwargs,
... expires=datetime.now() + timedelta(days=1)
When a worker receives a task that has been expired it will be
marked as revoked (:exc:`celery.exceptions.TaskRevokedError`).
* Changed the way logging is configured.
We now configure the root logger instead of only configuring
our custom logger. In addition we don't hijack
the multiprocessing logger anymore, but instead use a custom logger name
for different apps:
===================================== =====================================
**Application** **Logger Name**
===================================== =====================================
``celeryd`` "celery"
``celerybeat`` "celery.beat"
``celeryev`` "celery.ev"
===================================== =====================================
This means that the ``loglevel`` and ``logfile`` arguments will
affect all registered loggers (even those from 3rd party libraries).
Unless you configure the loggers manually as shown below, that is.
*Users can choose to configure logging by subscribing to the
:data:`~celery.signals.setup_logging` signal:*
.. code-block:: python
from logging.config import fileConfig
from celery import signals
def setup_logging(**kwargs):
fileConfig("logging.conf")
signals.setup_logging.connect(setup_logging)
If there are no receivers for this signal, the logging subsystem
will be configured using the :option:`--loglevel`/:option:`--logfile`
argument, this will be used for *all defined loggers*.
Remember that celeryd also redirects stdout and stderr
to the celery logger, if manually configure logging
you also need to redirect the stdouts manually:
.. code-block:: python
from logging.config import fileConfig
from celery import log
def setup_logging(**kwargs):
import logging
fileConfig("logging.conf")
stdouts = logging.getLogger("mystdoutslogger")
log.redirect_stdouts_to_logger(stdouts, loglevel=logging.WARNING)
* celeryd: Added command-line option :option:`-I`/:option:`--include`:
A comma separated list of (task) modules to be imported.
Example::
$ celeryd -I app1.tasks,app2.tasks
* celeryd: now emits a warning if running as the root user (euid is 0).
* :func:`celery.messaging.establish_connection`: Ability to override defaults
used using kwarg "defaults".
* celeryd: Now uses ``multiprocessing.freeze_support()`` so that it should work
with **py2exe**, **PyInstaller**, **cx_Freeze**, etc.
* celeryd: Now includes more metadata for the :state:`STARTED` state: PID and
hostname of the worker that started the task.
See issue #181
* subtask: Merge addititional keyword args to ``subtask()`` into task kwargs.
e.g:
>>> s = subtask((1, 2), {"foo": "bar"}, baz=1)
>>> s.args
(1, 2)
>>> s.kwargs
{"foo": "bar", "baz": 1}
See issue #182.
* celeryd: Now emits a warning if there is already a worker node using the same
name running on the same virtual host.
* AMQP result backend: Sending of results are now retried if the connection
is down.
* AMQP result backend: ``result.get()``: Wait for next state if state is not
in :data:`~celery.states.READY_STATES`.
* TaskSetResult now supports subscription.
::
>>> res = TaskSet(tasks).apply_async()
>>> res[0].get()
* Added ``Task.send_error_emails`` + ``Task.error_whitelist``, so these can
be configured per task instead of just by the global setting.
* Added ``Task.store_errors_even_if_ignored``, so it can be changed per Task,
not just by the global setting.
* The crontab scheduler no longer wakes up every second, but implements
``remaining_estimate`` (*Optimization*).
* celeryd: Store :state:`FAILURE` result if the
:exc:`~celery.exceptions.WorkerLostError` exception occurs (worker process
disappeared).
* celeryd: Store :state:`FAILURE` result if one of the ``*TimeLimitExceeded``
exceptions occurs.
* Refactored the periodic task responsible for cleaning up results.
* The backend cleanup task is now only added to the schedule if
:setting:`CELERY_TASK_RESULT_EXPIRES` is set.
* If the schedule already contains a periodic task named
"celery.backend_cleanup" it won't change it, so the behavior of the
backend cleanup task can be easily changed.
* The task is now run every day at 4:00 AM, rather than every day since
the first time it was run (using crontab schedule instead of
``run_every``)
* Renamed ``celery.task.builtins.DeleteExpiredTaskMetaTask``
-> :class:`celery.task.builtins.backend_cleanup`
* The task itself has been renamed from "celery.delete_expired_task_meta"
to "celery.backend_cleanup"
See issue #134.
* Implemented ``AsyncResult.forget`` for sqla/cache/redis/tyrant backends.
(Forget and remove task result).
See issue #184.
* :meth:`TaskSetResult.join <celery.result.TaskSetResult.join>`:
Added 'propagate=True' argument.
When set to :const:`False` exceptions occuring in subtasks will
not be re-raised.
* Added ``Task.update_state(task_id, state, meta)``
as a shortcut to ``task.backend.store_result(task_id, meta, state)``.
The backend interface is "private" and the terminology outdated,
so better to move this to :class:`~celery.task.base.Task` so it can be
used.
* timer2: Set ``self.running=False`` in
:meth:`~celery.utils.timer2.Timer.stop` so it won't try to join again on
subsequent calls to ``stop()``.
* Log colors are now disabled by default on Windows.
* ``celery.platform`` renamed to :mod:`celery.platforms`, so it doesn't
collide with the built-in :mod:`platform` module.
* Exceptions occuring in Mediator+Pool callbacks are now catched and logged
instead of taking down the worker.
* Redis result backend: Now supports result expiration using the Redis
``EXPIRE`` command.
* unittests: Don't leave threads running at teardown.
* celeryd: Task results shown in logs are now truncated to 46 chars.
* ``Task.__name__`` is now an alias to ``self.__class__.__name__``.
This way tasks introspects more like regular functions.
* ``Task.retry``: Now raises :exc:`TypeError` if kwargs argument is empty.
See issue #164.
* timedelta_seconds: Use ``timedelta.total_seconds`` if running on Python 2.7
* :class:`~celery.datastructures.TokenBucket`: Generic Token Bucket algorithm
* :mod:`celery.events.state`: Recording of cluster state can now
be paused and resumed, including support for buffering.
.. method:: State.freeze(buffer=True)
Pauses recording of the stream.
If ``buffer`` is true, events received while being frozen will be
buffered, and may be replayed later.
.. method:: State.thaw(replay=True)
Resumes recording of the stream.
If ``replay`` is true, then the recorded buffer will be applied.
.. method:: State.freeze_while(fun)
With a function to apply, freezes the stream before,
and replays the buffer after the function returns.
* :meth:`EventReceiver.capture <celery.events.EventReceiver.capture>`
Now supports a timeout keyword argument.
* celeryd: The mediator thread is now disabled if
:setting:`CELERY_RATE_LIMTS` is enabled, and tasks are directly sent to the
pool without going through the ready queue (*Optimization*).
.. _v210-fixes:
Fixes
-----
* Pool: Process timed out by TimeoutHandler must be joined by the Supervisor,
so don't remove it from self._pool
See issue #192.
* TaskPublisher.delay_task now supports exchange argument, so exchange can be
overriden when sending tasks in bulk using the same publisher
See issue #187.
* celeryd no longer marks tasks as revoked if :setting:`CELERY_IGNORE_RESULT`
is enabled.
See issue #207.
* AMQP Result backend: Fixed bug with ``result.get()`` if
:setting:`CELERY_TRACK_STARTED` enabled.
``result.get()`` would stop consuming after receiving the
:state:`STARTED` state.
* Fixed bug where new processes created by the pool supervisor becomes stuck
while reading from the task Queue.
See http://bugs.python.org/issue10037
* Fixed timing issue when declaring the remote control command reply queue
This issue could result in replies being lost, but have now been fixed.
* Compat ``LoggerAdapter`` implementation: Now works for Python 2.4.
Also added support for several new methods:
``fatal``, ``makeRecord``, ``_log``, ``log``, ``isEnabledFor``,
``addHandler``, ``removeHandler``.
.. _v210-experimental:
Experimental
------------
* celeryd-multi: Added daemonization support.
celeryd-multi can now be used to start, stop and restart worker nodes.
$ celeryd-multi start jerry elaine george kramer
This also creates pidfiles and logfiles (:file:`[email protected]`,
..., :file:`[email protected]`. To specify a location for these files
use the ``--pidfile`` and ``--logfile`` arguments with the ``%n``
format::
$ celeryd-multi start jerry elaine george kramer \
--logfile=/var/log/celeryd@%n.log \
--pidfile=/var/run/celeryd@%n.pid
Stopping::
$ celeryd-multi stop jerry elaine george kramer
Restarting. The nodes will be restarted one by one as the old ones
are shutdown::
$ celeryd-multi restart jerry elaine george kramer
Killing the nodes (**WARNING**: Will discard currently executing tasks)::
$ celeryd-multi kill jerry elaine george kramer
See ``celeryd-multi help`` for help.
* celeryd-multi: ``start`` command renamed to ``show``.
``celeryd-multi start`` will now actually start and detach worker nodes.
To just generate the commands you have to use ``celeryd-multi show``.
* celeryd: Added ``--pidfile`` argument.
The worker will write its pid when it starts. The worker will
not be started if this file exists and the pid contained is still alive.
* Added generic init.d script using ``celeryd-multi``
http://github.com/ask/celery/tree/master/contrib/generic-init.d/celeryd
.. _v210-documentation:
Documentation
-------------
* Added User guide section: Monitoring
* Added user guide section: Periodic Tasks
Moved from `getting-started/periodic-tasks` and updated.
* tutorials/external moved to new section: "community".
* References has been added to all sections in the documentation.
This makes it easier to link between documents.
.. _version-2.0.3:
2.0.3
=====
:release-date: 2010-08-27 12:00 P.M CEST
.. _v203-fixes:
Fixes
-----
* celeryd: Properly handle connection errors happening while
closing consumers.
* celeryd: Events are now buffered if the connection is down,
then sent when the connection is re-established.
* No longer depends on the :mod:`mailer` package.
This package had a namespace collision with ``django-mailer``,
so its functionality was replaced.
* Redis result backend: Documentation typos: Redis doesn't have
database names, but database numbers. The default database is now 0.
* :class:`~celery.task.control.inspect`:
``registered_tasks`` was requesting an invalid command because of a typo.
See issue #170.
* :setting:`CELERY_ROUTES`: Values defined in the route should now have
precedence over values defined in :setting:`CELERY_QUEUES` when merging
the two.
With the follow settings::
CELERY_QUEUES = {"cpubound": {"exchange": "cpubound",
"routing_key": "cpubound"}}
CELERY_ROUTES = {"tasks.add": {"queue": "cpubound",
"routing_key": "tasks.add",
"serializer": "json"}}
The final routing options for ``tasks.add`` will become::
{"exchange": "cpubound",
"routing_key": "tasks.add",
"serializer": "json"}
This was not the case before: the values
in :setting:`CELERY_QUEUES` would take precedence.
* Worker crashed if the value of :setting:`CELERY_TASK_ERROR_WHITELIST` was
not an iterable
* :func:`~celery.execute.apply`: Make sure ``kwargs["task_id"]`` is
always set.
* ``AsyncResult.traceback``: Now returns :const:`None`, instead of raising
:exc:`KeyError` if traceback is missing.
* :class:`~celery.task.control.inspect`: Replies did not work correctly
if no destination was specified.
* Can now store result/metadata for custom states.
* celeryd: A warning is now emitted if the sending of task error
e-mails fails.
* celeryev: Curses monitor no longer crashes if the terminal window
is resized.
See issue #160.
* celeryd: On OS X it is not possible to run ``os.exec*`` in a process
that is threaded.
This breaks the SIGHUP restart handler,
and is now disabled on OS X, emitting a warning instead.
See issue #152.
* :mod:`celery.execute.trace`: Properly handle ``raise(str)``,
which is still allowed in Python 2.4.
See issue #175.
* Using urllib2 in a periodic task on OS X crashed because
of the proxy autodetection used in OS X.
This is now fixed by using a workaround.
See issue #143.
* Debian init scripts: Commands should not run in a subshell
See issue #163.
* Debian init scripts: Use abspath for celeryd to allow stat
See issue #162.
.. _v203-documentation:
Documentation
-------------
* getting-started/broker-installation: Fixed typo
``set_permissions ""`` -> ``set_permissions ".*"``.
* Tasks Userguide: Added section on database transactions.
See issue #169.
* Routing Userguide: Fixed typo ``"feed": -> {"queue": "feeds"}``.
See issue #169.
* Documented the default values for the :setting:`CELERYD_CONCURRENCY`
and :setting:`CELERYD_PREFETCH_MULTIPLIER` settings.
* Tasks Userguide: Fixed typos in the subtask example
* celery.signals: Documented worker_process_init.
* Daemonization cookbook: Need to export DJANGO_SETTINGS_MODULE in
``/etc/default/celeryd``.
* Added some more FAQs from stack overflow
* Daemonization cookbook: Fixed typo ``CELERYD_LOGFILE/CELERYD_PIDFILE``
to ``CELERYD_LOG_FILE`` / ``CELERYD_PID_FILE``
Also added troubleshooting section for the init scripts.
.. _version-2.0.2:
2.0.2
=====
:release-date: 2010-07-22 11:31 A.M CEST
* Routes: When using the dict route syntax, the exchange for a task
could dissapear making the task unroutable.
See issue #158.
* Test suite now passing on Python 2.4
* No longer have to type PYTHONPATH=. to use celeryconfig in current dir.
This is accomplished by the default loader ensuring that the current
directory is in ``sys.path`` when loading the config module.
``sys.path`` is reset to its original state after loading.
Adding cwd to ``sys.path`` without the user knowing may be a security
issue, as this means someone can drop a Python module in the users
directory that executes arbitrary commands. This was the original reason
not to do this, but if done *only when loading the config module*, this
means that the behvavior will only apply to the modules imported in the
config module, which I think is a good compromise (certainly better than
just explictly setting PYTHONPATH=. anyway)
* Experimental Cassandra backend added.
* celeryd: SIGHUP handler accidentally propagated to worker pool processes.
In combination with 7a7c44e39344789f11b5346e9cc8340f5fe4846c
this would make each child process start a new celeryd when
the terminal window was closed :/
* celeryd: Do not install SIGHUP handler if running from a terminal.
This fixes the problem where celeryd is launched in the background
when closing the terminal.
* celeryd: Now joins threads at shutdown.
See issue #152.
* Test teardown: Don't use atexit but nose's ``teardown()`` functionality
instead.
See issue #154.
* Debian init script for celeryd: Stop now works correctly.
* Task logger: ``warn`` method added (synonym for ``warning``)
* Can now define a whitelist of errors to send error e-mails for.
Example::
CELERY_TASK_ERROR_WHITELIST = ('myapp.MalformedInputError')
See issue #153.
* celeryd: Now handles overflow exceptions in ``time.mktime`` while parsing
the ETA field.
* LoggerWrapper: Try to detect loggers logging back to stderr/stdout making
an infinite loop.
* Added :class:`celery.task.control.inspect`: Inspects a running worker.
Examples::
# Inspect a single worker
>>> i = inspect("myworker.example.com")
# Inspect several workers
>>> i = inspect(["myworker.example.com", "myworker2.example.com"])
# Inspect all workers consuming on this vhost.
>>> i = inspect()
### Methods
# Get currently executing tasks
>>> i.active()
# Get currently reserved tasks
>>> i.reserved()
# Get the current eta schedule
>>> i.scheduled()
# Worker statistics and info
>>> i.stats()
# List of currently revoked tasks
>>> i.revoked()
# List of registered tasks
>>> i.registered_tasks()
* Remote control commands ``dump_active``/``dump_reserved``/``dump_schedule``
now replies with detailed task requests.
Containing the original arguments and fields of the task requested.
In addition the remote control command ``set_loglevel`` has been added,
this only changes the loglevel for the main process.
* Worker control command execution now catches errors and returns their
string representation in the reply.
* Functional test suite added
:mod:`celery.tests.functional.case` contains utilities to start
and stop an embedded celeryd process, for use in functional testing.
.. _version-2.0.1:
2.0.1
=====
:release-date: 2010-07-09 03:02 P.M CEST
* multiprocessing.pool: Now handles encoding errors, so that pickling errors
doesn't crash the worker processes.
* The remote control command replies was not working with RabbitMQ 1.8.0's
stricter equivalence checks.
If you've already hit this problem you may have to delete the
declaration::
$ camqadm exchange.delete celerycrq
or::
$ python manage.py camqadm exchange.delete celerycrq
* A bug sneaked in the ETA scheduler that made it only able to execute
one task per second(!)
The scheduler sleeps between iterations so it doesn't consume too much CPU.
It keeps a list of the scheduled items sorted by time, at each iteration
it sleeps for the remaining time of the item with the nearest deadline.
If there are no eta tasks it will sleep for a minimum amount of time, one
second by default.
A bug sneaked in here, making it sleep for one second for every task
that was scheduled. This has been fixed, so now it should move
tasks like hot knife through butter.
In addition a new setting has been added to control the minimum sleep
interval; :setting:`CELERYD_ETA_SCHEDULER_PRECISION`. A good
value for this would be a float between 0 and 1, depending
on the needed precision. A value of 0.8 means that when the ETA of a task
is met, it will take at most 0.8 seconds for the task to be moved to the
ready queue.
* Pool: Supervisor did not release the semaphore.
This would lead to a deadlock if all workers terminated prematurely.
* Added Python version trove classifiers: 2.4, 2.5, 2.6 and 2.7
* Tests now passing on Python 2.7.
* Task.__reduce__: Tasks created using the task decorator can now be pickled.
* setup.py: nose added to ``tests_require``.
* Pickle should now work with SQLAlchemy 0.5.x
* New homepage design by Jan Henrik Helmers: http://celeryproject.org
* New Sphinx theme by Armin Ronacher: http://celeryproject.org/docs
* Fixed "pending_xref" errors shown in the HTML rendering of the
documentation. Apparently this was caused by new changes in Sphinx 1.0b2.
* Router classes in :setting:`CELERY_ROUTES` are now imported lazily.
Importing a router class in a module that also loads the Celery
environment would cause a circular dependency. This is solved
by importing it when needed after the environment is set up.
* :setting:`CELERY_ROUTES` was broken if set to a single dict.
This example in the docs should now work again::
CELERY_ROUTES = {"feed.tasks.import_feed": "feeds"}
* ``CREATE_MISSING_QUEUES`` was not honored by apply_async.
* New remote control command: ``stats``
Dumps information about the worker, like pool process pids, and
total number of tasks executed by type.
Example reply::
[{'worker.local':
'total': {'tasks.sleeptask': 6},
'pool': {'timeouts': [None, None],
'processes': [60376, 60377],
'max-concurrency': 2,
'max-tasks-per-child': None,
'put-guarded-by-semaphore': True}}]
* New remote control command: ``dump_active``
Gives a list of tasks currently being executed by the worker.
By default arguments are passed through repr in case there
are arguments that is not JSON encodable. If you know
the arguments are JSON safe, you can pass the argument ``safe=True``.
Example reply::
>>> broadcast("dump_active", arguments={"safe": False}, reply=True)
[{'worker.local': [
{'args': '(1,)',
'time_start': 1278580542.6300001,
'name': 'tasks.sleeptask',
'delivery_info': {
'consumer_tag': '30',
'routing_key': 'celery',
'exchange': 'celery'},
'hostname': 'casper.local',
'acknowledged': True,
'kwargs': '{}',
'id': '802e93e9-e470-47ed-b913-06de8510aca2',
}
]}]
* Added experimental support for persistent revokes.
Use the ``-S|--statedb`` argument to celeryd to enable it::
$ celeryd --statedb=/var/run/celeryd
This will use the file: ``/var/run/celeryd.db``,
as the ``shelve`` module automatically adds the ``.db`` suffix.
.. _version-2.0.0:
2.0.0
=====
:release-date: 2010-07-02 02:30 P.M CEST
Foreword
--------
Celery 2.0 contains backward incompatible changes, the most important
being that the Django dependency has been removed so Celery no longer
supports Django out of the box, but instead as an add-on package
called `django-celery`_.
We're very sorry for breaking backwards compatibility, but there's
also many new and exciting features to make up for the time you lose
upgrading, so be sure to read the :ref:`News <v200-news>` section.
Quite a lot of potential users have been upset about the Django dependency,
so maybe this is a chance to get wider adoption by the Python community as
well.
Big thanks to all contributors, testers and users!
.. _v200-django-upgrade:
Upgrading for Django-users
--------------------------
Django integration has been moved to a separate package: `django-celery`_.
* To upgrade you need to install the `django-celery`_ module and change::
INSTALLED_APPS = "celery"
to::
INSTALLED_APPS = "djcelery"
* If you use ``mod_wsgi`` you need to add the following line to your ``.wsgi``
file::
import os
os.environ["CELERY_LOADER"] = "django"
* The following modules has been moved to `django-celery`_:
===================================== =====================================
**Module name** **Replace with**
===================================== =====================================
``celery.models`` ``djcelery.models``
``celery.managers`` ``djcelery.managers``
``celery.views`` ``djcelery.views``
``celery.urls`` ``djcelery.urls``
``celery.management`` ``djcelery.management``
``celery.loaders.djangoapp`` ``djcelery.loaders``
``celery.backends.database`` ``djcelery.backends.database``
``celery.backends.cache`` ``djcelery.backends.cache``
===================================== =====================================
Importing :mod:`djcelery` will automatically setup Celery to use Django loader.
loader. It does this by setting the :envvar:`CELERY_LOADER` environment variable to
``"django"`` (it won't change it if a loader is already set.)
When the Django loader is used, the "database" and "cache" result backend
aliases will point to the :mod:`djcelery` backends instead of the built-in backends,
and configuration will be read from the Django settings.
.. _`django-celery`: http://pypi.python.org/pypi/django-celery
.. _v200-upgrade:
Upgrading for others
--------------------
.. _v200-upgrade-database:
Database result backend
~~~~~~~~~~~~~~~~~~~~~~~
The database result backend is now using `SQLAlchemy`_ instead of the
Django ORM, see `Supported Databases`_ for a table of supported databases.
The ``DATABASE_*`` settings has been replaced by a single setting:
:setting:`CELERY_RESULT_DBURI`. The value here should be an
`SQLAlchemy Connection String`_, some examples include:
.. code-block:: python
# sqlite (filename)
CELERY_RESULT_DBURI = "sqlite:///celerydb.sqlite"
# mysql
CELERY_RESULT_DBURI = "mysql://scott:tiger@localhost/foo"
# postgresql
CELERY_RESULT_DBURI = "postgresql://scott:tiger@localhost/mydatabase"
# oracle
CELERY_RESULT_DBURI = "oracle://scott:[email protected]:1521/sidname"
See `SQLAlchemy Connection Strings`_ for more information about connection
strings.
To specify additional SQLAlchemy database engine options you can use
the :setting:`CELERY_RESULT_ENGINE_OPTIONS` setting::
# echo enables verbose logging from SQLAlchemy.
CELERY_RESULT_ENGINE_OPTIONS = {"echo": True}
.. _`SQLAlchemy`:
http://www.sqlalchemy.org
.. _`Supported Databases`:
http://www.sqlalchemy.org/docs/dbengine.html#supported-databases
.. _`SQLAlchemy Connection String`:
http://www.sqlalchemy.org/docs/dbengine.html#create-engine-url-arguments
.. _`SQLAlchemy Connection Strings`:
http://www.sqlalchemy.org/docs/dbengine.html#create-engine-url-arguments
.. _v200-upgrade-cache:
Cache result backend
~~~~~~~~~~~~~~~~~~~~
The cache result backend is no longer using the Django cache framework,
but it supports mostly the same configuration syntax::
CELERY_CACHE_BACKEND = "memcached://A.example.com:11211;B.example.com"
To use the cache backend you must either have the `pylibmc`_ or
`python-memcached`_ library installed, of which the former is regarded