简体   繁体   中英

Celerybeat doesn't work as expected

I'm building some project with bottle and I need it to run certain scheduled actions periodically.

I decided to go with rabbitmq + celery since that seemed like the most robust & complete solution to manage scheduled works programatically.

I installed both rabbitmq and celery okay, and when I use celeryd -B , tasks get done okay. However when I use celerybeat command, tasks are "sent" (or so says the output, cause I run both celeryd and celerybeat with -l debug option to be more verbose), but though they are regularly being "sent", they don't get executed (for testing purposes, task ought to appent current timestamp to a file every 60 sec). Anyway, everything else works fine since celeryd -B command in the same directory works just fine, it writes the file in expected intervals.

Am I missing something?

Here is the output of $celerybeat -l debug:

[2012-06-30 18:07:44,676: WARNING/MainProcess] celerybeat v2.5.5 is starting.
[2012-06-30 18:07:44,750: WARNING/MainProcess] __    -    ... __   -        _
Configuration ->
    . broker -> amqp://guest@localhost:5672//
    . loader -> celery.loaders.default.Loader
    . scheduler -> celery.beat.PersistentScheduler
    . db -> celerybeat-schedule
    . logfile -> [stderr]@DEBUG
    . maxinterval -> 5.00 minutes (300s)
[2012-06-30 18:07:44,751: DEBUG/MainProcess] Setting default socket timeout to 30
[2012-06-30 18:07:44,751: INFO/MainProcess] Celerybeat: Starting...
[2012-06-30 18:07:44,776: DEBUG/MainProcess] Current schedule:
<Entry: celery.backend_cleanup celery.backend_cleanup() {<crontab: 0 4 * (m/h/d)>}
<Entry: often tasks.output() {<freq: 1.00 minute>}
[2012-06-30 18:07:44,776: DEBUG/MainProcess] Celerybeat: Ticking with max interval->5.00 minutes
[2012-06-30 18:07:44,781: DEBUG/MainProcess] Start from server, version: 8.0, properties: {u'information': u'Licensed under the MPL.  See http://www.rabbitmq.com/', u'product': u'RabbitMQ', u'copyright': u'Copyright (C) 2007-2012 VMware, Inc.', u'capabilities': {}, u'platform': u'Erlang/OTP', u'version': u'2.8.4'}, mechanisms: [u'PLAIN', u'AMQPLAIN'], locales: [u'en_US']
[2012-06-30 18:07:44,785: DEBUG/MainProcess] Open OK! known_hosts []
[2012-06-30 18:07:44,787: DEBUG/MainProcess] using channel_id: 1
[2012-06-30 18:07:44,789: DEBUG/MainProcess] Channel open
[2012-06-30 18:07:44,790: INFO/MainProcess] Scheduler: Sending due task tasks.output
[2012-06-30 18:07:44,794: DEBUG/MainProcess] Celerybeat: Synchronizing schedule...
[2012-06-30 18:07:44,838: DEBUG/MainProcess] tasks.output sent. id->53951ab0-022d-40a5-9f56-9a4a294294c7
[2012-06-30 18:07:44,838: DEBUG/MainProcess] Celerybeat: Waking up in 1.00 minute.

Celerybeat, on its own, simply keeps time and shovels tasks onto the appropriate queue for someone else to consume.

Ergo, start a celeryd process listening to the queue(s) you want to process:

$ celeryd <queuename> -l DEBUG

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM