question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Broken with timezone support enabled in Django 1.4

See original GitHub issue
[2012-07-09 13:04:27,650: WARNING/Beat] Process Beat:
[2012-07-09 13:04:27,650: WARNING/Beat] Traceback (most recent call last):
[2012-07-09 13:04:27,650: WARNING/Beat] File "/Users/jezdez/.virtualenvs/gidsy/lib/python2.7/site-packages/billiard/process.py", line 273, in _bootstrap
[2012-07-09 13:04:27,651: WARNING/Beat] self.run()
[2012-07-09 13:04:27,651: WARNING/Beat] File "/Users/jezdez/.virtualenvs/gidsy/lib/python2.7/site-packages/celery/beat.py", line 462, in run
[2012-07-09 13:04:27,652: WARNING/Beat] self.service.start(embedded_process=True)
[2012-07-09 13:04:27,652: WARNING/Beat] File "/Users/jezdez/.virtualenvs/gidsy/lib/python2.7/site-packages/celery/beat.py", line 400, in start
[2012-07-09 13:04:27,652: WARNING/Beat] interval = self.scheduler.tick()
[2012-07-09 13:04:27,652: WARNING/Beat] File "/Users/jezdez/.virtualenvs/gidsy/lib/python2.7/site-packages/celery/beat.py", line 193, in tick
[2012-07-09 13:04:27,653: WARNING/Beat] next_time_to_run = self.maybe_due(entry, self.publisher)
[2012-07-09 13:04:27,653: WARNING/Beat] File "/Users/jezdez/.virtualenvs/gidsy/lib/python2.7/site-packages/celery/beat.py", line 171, in maybe_due
[2012-07-09 13:04:27,653: WARNING/Beat] is_due, next_time_to_run = entry.is_due()
[2012-07-09 13:04:27,654: WARNING/Beat] File "/Users/jezdez/.virtualenvs/gidsy/lib/python2.7/site-packages/djcelery/schedulers.py", line 59, in is_due
[2012-07-09 13:04:27,654: WARNING/Beat] return self.schedule.is_due(self.last_run_at)
[2012-07-09 13:04:27,654: WARNING/Beat] File "/Users/jezdez/.virtualenvs/gidsy/lib/python2.7/site-packages/celery/schedules.py", line 72, in is_due
[2012-07-09 13:04:27,655: WARNING/Beat] rem_delta = self.remaining_estimate(last_run_at)
[2012-07-09 13:04:27,655: WARNING/Beat] File "/Users/jezdez/.virtualenvs/gidsy/lib/python2.7/site-packages/celery/schedules.py", line 42, in remaining_estimate
[2012-07-09 13:04:27,655: WARNING/Beat] now=self.now())
[2012-07-09 13:04:27,656: WARNING/Beat] File "/Users/jezdez/.virtualenvs/gidsy/lib/python2.7/site-packages/celery/utils/timeutils.py", line 145, in remaining
[2012-07-09 13:04:27,656: WARNING/Beat] return end_date - now
[2012-07-09 13:04:27,656: WARNING/Beat] TypeError: can't subtract offset-naive and offset-aware datetimes

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
bmboutercommented, Jul 23, 2012

I think this is still broken. I am using celery==3.0.3 and django-celery==3.0.1 and pytz==2012c

I am following this documentation

In my settings.py I have: CELERY_ENABLE_UTC = False CELERY_TIMEZONE = ‘America/New_York’ USE_TZ = True TIME_ZONE = ‘America/New_York’

I am using this task code. send_hour is set by this link.

I recently updated the time-zone settings and that is when this broke. I post the comment here because I received a very similar traceback as this post. I then deleted the celery scheduler database and the worker now starts correctly.

The task should be run daily at 6pm EDT, but instead I receive it perfectly at 2pm EDT, which is 6PM UTC. Therefore I conclude that some part of running celery through django-celery is not using my local timezone.

0reactions
bmboutercommented, Sep 6, 2012

This fixed the problem perfectly for me too. I tested it!

Great job Ask!

Best, Brian

On Fri, Aug 24, 2012 at 4:18 AM, aleg notifications@github.com wrote:

Great! This fixes the problem for me. Thanks linhlarry!

— Reply to this email directly or view it on GitHubhttps://github.com/celery/django-celery/issues/150#issuecomment-7995194.

Brian Bouterse The Friday Institute

Read more comments on GitHub >

github_iconTop Results From Across the Web

Time zone support enabled in Django 1.4, yet "Django does ...
Hello, I recently upgraded one of my machines to Django 1.4 to patch a bug related to the use of PostGIS 9.1. I...
Read more >
Time zones - Django documentation
When you enable time zone support, Django interprets datetimes entered in forms in the current time zone and returns aware datetime objects in...
Read more >
Django timezone localization not working as expected
The conversion to my local time which is IST is not happening though I used the block and filter given in the docs....
Read more >
django Changelog - pyup.io
Django 4.1 supports Python 3.8, 3.9, 3.10, and 3.11 (as of 4.1.3). We ... Django 3.2 allowed the use of non-``pytz`` time zones....
Read more >
[Solved]-Django timezone.now() remains unchanged-django
When should I activate/deactivate the current timezone in Django (1.4)? ... Django Project Done and Working. Now What? ... Which timezone does Django...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found