-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to customize timezone used by Celery [feature request] #183
Comments
Hi @bgottsch , Indeed this is a very good idea ! I will check at the beginning of next week the Thanks your your help on this project 👍 |
Hi @ncrocfer , Thanks for the quick reply. Update on the implementationI created a fork of this repo and a dev/timezone branch. For now, I'm ignoring Preview of code changes to
I'm trying to keep it as simple as possible. ResultsBy setting Preview of code changes to
Is there a reason for Flower not using the Celery app instance? As per pull request, there is no mention of why it is different than beat or worker. MiscAs a check, the webserver UI displays the timezone correctly, as per user local timezone. The implementation below is working as expected: File
|
Here's a merge comparison for better readability: merge with dev/timezone |
Hi everyone,
I found no way to customize the timezone used by Celery and would like to propose an improvement.
This would be very useful, since the
periodic: crontab
feature defaults to UTC timezone, making the cron definition "harder to understand".Explaining the functionality in Celery
By Celery 5.2.7 documentation, timezones should be implemented by configuring the following parameters when creating the Celery app:
enable_utc
andtimezone
.As explained there,
enable_utc
defaults to true, and if true uses UTC as the default timezone for Celery. If set to false, Celery uses the system's timezone (in case of docker / docker-compose, it should be easily set by the TZ environment variable).Likewise, when
timezone
is set to an appropriate pytz value, Celery uses it.Changes to celery-director
DIRECTOR_TZ
orDIRECTOR_ENABLE_UTC
webserver
UTC adjustmentAbout the pull request
I'm able and willing to create this modification and help as needed.
What I need is guidance on whether or not this should be done. And if so, how it should be done. Both
enable_utc
andtimezone
allow for the timezone to be customized, but I have doubts about which one is better to use.My initial idea was to create only
DIRECTOR_TZ
and modify the code to check if it is set. And if not, default to UTC (default value in Celery).Anyways,
Thanks for this amazing project!
Best regards
The text was updated successfully, but these errors were encountered: