Reputation: 194
I'm using Django 1.8 and celery 4.0.2. When I start celery beat, it throws a TypeError
celery beat v4.0.2 (latentcall) is starting.
__ - ... __ - _
LocalTime -> 2017-03-13 20:38:22
Configuration ->
. broker -> redis://127.0.0.1:6379//
. loader -> celery.loaders.app.AppLoader
. scheduler -> celery.beat.PersistentScheduler
. db -> celerybeat-schedule
. logfile -> [stderr]@%WARNING
. maxinterval -> 5.00 minutes (300s)
[2017-03-13 20:38:23,094: CRITICAL/MainProcess] beat raised exception <type 'exceptions.TypeError'>: TypeError('astimezone() argument 1 must be datetime.tzinfo, not tuple',)
Traceback (most recent call last):
File "/home/renq/PycharmProjects/Kimi/.pyenv/lib/python2.7/site-packages/celery/apps/beat.py", line 107, in start_scheduler
service.start()
File "/home/renq/PycharmProjects/Kimi/.pyenv/lib/python2.7/site-packages/celery/beat.py", line 537, in start
interval = self.scheduler.tick()
File "/home/renq/PycharmProjects/Kimi/.pyenv/lib/python2.7/site-packages/celery/beat.py", line 255, in tick
for e in values(self.schedule)]
File "/home/renq/PycharmProjects/Kimi/.pyenv/lib/python2.7/site-packages/celery/beat.py", line 134, in is_due
return self.schedule.is_due(self.last_run_at)
File "/home/renq/PycharmProjects/Kimi/.pyenv/lib/python2.7/site-packages/celery/schedules.py", line 612, in is_due
rem_delta = self.remaining_estimate(last_run_at)
File "/home/renq/PycharmProjects/Kimi/.pyenv/lib/python2.7/site-packages/celery/schedules.py", line 601, in remaining_estimate
return remaining(*self.remaining_delta(last_run_at, ffwd=ffwd))
File "/home/renq/PycharmProjects/Kimi/.pyenv/lib/python2.7/site-packages/celery/schedules.py", line 538, in remaining_delta
last_run_at = self.maybe_make_aware(last_run_at)
File "/home/renq/PycharmProjects/Kimi/.pyenv/lib/python2.7/site-packages/celery/schedules.py", line 81, in maybe_make_aware
return maybe_make_aware(dt, self.tz)
File "/home/renq/PycharmProjects/Kimi/.pyenv/lib/python2.7/site-packages/celery/utils/time.py", line 326, in maybe_make_aware
dt, timezone.utc if tz is None else timezone.tz_or_local(tz),
File "/home/renq/PycharmProjects/Kimi/.pyenv/lib/python2.7/site-packages/celery/utils/time.py", line 301, in localize
dt = dt.astimezone(tz)
TypeError: astimezone() argument 1 must be datetime.tzinfo, not tuple
My celery settings are
CELERY_BROKER_URL = 'redis://127.0.0.1:6379',
CELERY_TIMEZONE = 'Asia/Shanghai',
CELERYBEAT_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler',
CELERY_RESULT_BACKEND = 'django-db'
I configured timezone to 'Asia/Shanghai' and using localhost redis. Why celery beat throws this error?
Upvotes: 0
Views: 229
Reputation: 599580
You need to remove the commas from the end of each line. 'Asia/Shanghai',
is a tuple rather than a string.
Upvotes: 3