我怎样才能使用芹菜时间表?

时间:2017-04-17 03:48:03

标签: celery

我已将http://docs.celeryproject.org/en/master/userguide/periodic-tasks.html doc作为参考。但这不是开始节拍时间的信息。

我无法使用此命令celery worker -A worker.cntv -B -Q default -l info启动芹菜节拍模式。

我在工作包下定义了一个worker:

@app.task
def test(args):
    print "this is test for schedule " + args

我定义了这个节拍时间表:

app.conf.beat_schedule = {
    'cntv-test': {
        'task': 'worker.cntv.test',
        'schedule': timedelta(seconds=10),
        'args': ('args',),
    },
}

以下是错误代码:

[2017-04-17 11:43:38,022: INFO/Beat] beat: Starting...
[2017-04-17 11:43:38,027: ERROR/Beat] Process Beat
Traceback (most recent call last):
  File "/home/mi/.pyenv/versions/2.7.12/envs/2.7.12_celery/lib/python2.7/site-packages/billiard/process.py", line 306, in _bootstrap
    self.run()
  File "/home/mi/.pyenv/versions/2.7.12/envs/2.7.12_celery/lib/python2.7/site-packages/celery/beat.py", line 613, in run
    self.service.start(embedded_process=True)
  File "/home/mi/.pyenv/versions/2.7.12/envs/2.7.12_celery/lib/python2.7/site-packages/celery/beat.py", line 528, in start
    humanize_seconds(self.scheduler.max_interval))
  File "/home/mi/.pyenv/versions/2.7.12/envs/2.7.12_celery/lib/python2.7/site-packages/kombu/utils/objects.py", line 44, in __get__
    value = obj.__dict__[self.__name__] = self.__get(obj)
  File "/home/mi/.pyenv/versions/2.7.12/envs/2.7.12_celery/lib/python2.7/site-packages/celery/beat.py", line 572, in scheduler
    return self.get_scheduler()
  File "/home/mi/.pyenv/versions/2.7.12/envs/2.7.12_celery/lib/python2.7/site-packages/celery/beat.py", line 567, in get_scheduler
    lazy=lazy,
  File "/home/mi/.pyenv/versions/2.7.12/envs/2.7.12_celery/lib/python2.7/site-packages/celery/beat.py", line 407, in __init__
    Scheduler.__init__(self, *args, **kwargs)
  File "/home/mi/.pyenv/versions/2.7.12/envs/2.7.12_celery/lib/python2.7/site-packages/celery/beat.py", line 204, in __init__
    self.setup_schedule()
  File "/home/mi/.pyenv/versions/2.7.12/envs/2.7.12_celery/lib/python2.7/site-packages/celery/beat.py", line 435, in setup_schedule
    self._create_schedule()
  File "/home/mi/.pyenv/versions/2.7.12/envs/2.7.12_celery/lib/python2.7/site-packages/celery/beat.py", line 464, in _create_schedule
    self._store[str('entries')]
  File "/home/mi/.pyenv/versions/2.7.12/lib/python2.7/shelve.py", line 122, in __getitem__
    value = Unpickler(f).load()
EOFError
[2017-04-17 11:43:38,028: WARNING/Beat] Process Beat:
[2017-04-17 11:43:38,028: WARNING/Beat] Traceback (most recent call last):
[2017-04-17 11:43:38,029: WARNING/Beat] File "/home/mi/.pyenv/versions/2.7.12/envs/2.7.12_celery/lib/python2.7/site-packages/billiard/process.py", line 306, in _bootstrap
[2017-04-17 11:43:38,029: WARNING/Beat] self.run()
[2017-04-17 11:43:38,029: WARNING/Beat] File "/home/mi/.pyenv/versions/2.7.12/envs/2.7.12_celery/lib/python2.7/site-packages/celery/beat.py", line 613, in run
[2017-04-17 11:43:38,029: WARNING/Beat] self.service.start(embedded_process=True)
[2017-04-17 11:43:38,029: WARNING/Beat] File "/home/mi/.pyenv/versions/2.7.12/envs/2.7.12_celery/lib/python2.7/site-packages/celery/beat.py", line 528, in start
[2017-04-17 11:43:38,029: WARNING/Beat] humanize_seconds(self.scheduler.max_interval))
[2017-04-17 11:43:38,029: WARNING/Beat] File "/home/mi/.pyenv/versions/2.7.12/envs/2.7.12_celery/lib/python2.7/site-packages/kombu/utils/objects.py", line 44, in __get__
[2017-04-17 11:43:38,029: WARNING/Beat] value = obj.__dict__[self.__name__] = self.__get(obj)
[2017-04-17 11:43:38,029: WARNING/Beat] File "/home/mi/.pyenv/versions/2.7.12/envs/2.7.12_celery/lib/python2.7/site-packages/celery/beat.py", line 572, in scheduler
[2017-04-17 11:43:38,029: WARNING/Beat] return self.get_scheduler()
[2017-04-17 11:43:38,030: WARNING/Beat] File "/home/mi/.pyenv/versions/2.7.12/envs/2.7.12_celery/lib/python2.7/site-packages/celery/beat.py", line 567, in get_scheduler
[2017-04-17 11:43:38,030: WARNING/Beat] lazy=lazy,
[2017-04-17 11:43:38,030: WARNING/Beat] File "/home/mi/.pyenv/versions/2.7.12/envs/2.7.12_celery/lib/python2.7/site-packages/celery/beat.py", line 407, in __init__
[2017-04-17 11:43:38,030: WARNING/Beat] Scheduler.__init__(self, *args, **kwargs)
[2017-04-17 11:43:38,030: WARNING/Beat] File "/home/mi/.pyenv/versions/2.7.12/envs/2.7.12_celery/lib/python2.7/site-packages/celery/beat.py", line 204, in __init__
[2017-04-17 11:43:38,030: WARNING/Beat] self.setup_schedule()
[2017-04-17 11:43:38,030: WARNING/Beat] File "/home/mi/.pyenv/versions/2.7.12/envs/2.7.12_celery/lib/python2.7/site-packages/celery/beat.py", line 435, in setup_schedule
[2017-04-17 11:43:38,030: WARNING/Beat] self._create_schedule()
[2017-04-17 11:43:38,030: WARNING/Beat] File "/home/mi/.pyenv/versions/2.7.12/envs/2.7.12_celery/lib/python2.7/site-packages/celery/beat.py", line 464, in _create_schedule
[2017-04-17 11:43:38,030: WARNING/Beat] self._store[str('entries')]
[2017-04-17 11:43:38,030: WARNING/Beat] File "/home/mi/.pyenv/versions/2.7.12/lib/python2.7/shelve.py", line 122, in __getitem__
[2017-04-17 11:43:38,031: WARNING/Beat] value = Unpickler(f).load()
[2017-04-17 11:43:38,031: WARNING/Beat] EOFError

更新

我使用redis作为经纪人,我使用的是Celery 4.0.2

0 个答案:

没有答案