2

我似乎无法为 django celerybeat 时间表设置 month_of_year。它不断抛出索引超出范围错误。

这是我的日程安排:

# Annual task to permanently delete all transactions that are older 
# than 2 years old.
'annual-transaction-deletion': {
    'task': 'project.tasks.annual_transactions_deletion',
    'schedule': crontab(hour='2', minute=0, day_of_month=1, month_of_year=1)
}

我尝试将上面的 month_of_year 也设置为 month_of_year=[1] 和 month_of_year='1'

以下堆栈跟踪打印在 celerybeat 日志中:

[2012-12-19 09:50:06,403: CRITICAL/MainProcess] celerybeat raised exception <type 'exceptions.IndexError'>: IndexError('list index out of range',)
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/celery/apps/beat.py", line 100, in start_scheduler
beat.start()
  File "/usr/local/lib/python2.7/dist-packages/celery/beat.py", line 422, in start
interval = self.scheduler.tick()
  File "/usr/local/lib/python2.7/dist-packages/celery/beat.py", line 194, in tick
next_time_to_run = self.maybe_due(entry, self.publisher)
  File "/usr/local/lib/python2.7/dist-packages/celery/beat.py", line 172, in maybe_due
is_due, next_time_to_run = entry.is_due()
  File "/usr/local/lib/python2.7/dist-packages/djcelery/schedulers.py", line 65, in is_due
return self.schedule.is_due(self.last_run_at)
  File "/usr/local/lib/python2.7/dist-packages/celery/schedules.py", line 502, in is_due
rem_delta = self.remaining_estimate(last_run_at)
  File "/usr/local/lib/python2.7/dist-packages/celery/schedules.py", line 489, in remaining_estimate
next_hour, next_minute)
  File "/usr/local/lib/python2.7/dist-packages/celery/schedules.py", line 389, in _delta_to_next
roll_over()
  File "/usr/local/lib/python2.7/dist-packages/celery/schedules.py", line 372, in roll_over
months_of_year[datedata.moy],
IndexError: list index out of range

我有许多其他的时间表来设置这项工作,但不包括month_of_year。上述时间表只需要每年运行一次。我不禁觉得这是芹菜库中的一个错误,但我渴望有人证明我错了。显然,如果这是一个错误,我不想诉诸修改库文件来修复它。任何帮助深表感谢。

4

0 回答 0