-
Notifications
You must be signed in to change notification settings - Fork 161
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
Use server local time for everything, not UTC #69
Conversation
I'd imagine this will probably introduce weird behavior around daylight savings time changes on servers not running UTC. Worth it? |
Most things I've used have been server time. Sending UTC to front end makes more sense though because it allows local time representation if you or the user prefers that. In which way will this solve the "Time until next run" issue? ie if I have a cron for "18 00 * * *" and my server is West coast, I'm east coast, will it tell me "Next run at 9:00pm" (my local eastern time) or will it show 6 (server time)? If we're doing crons on server time it might be useful to see the current server time in the front end. Whatever gets chosen, as long as its documented should be fine! |
Could be weird on DST I suppose, like when a server loses an hour and jobs are scheduled during that hour..... |
I deal with Timezones a lot in the stuff i deal with at work. In my experience you always store time in utc and store the time zone that you want that utc interpreted by separately. The time zone should almost always be based of a location as opposed to the actual time zone. i.e I would store "America/New York" as opposed to "Eastern" because Eastern can be ambiguous with daylight savings. This is how the Olson database is setup. I think in the UI you should be able to specify the Timezone (based off pytz name) you want the cron to be interpreted from. In the database you store the run time based of the cron string and that timezone, but store the time as UTC. We don't rely on server time at all except maybe as the default in the time zone drop down. At least in my case I always want to run my processes at starting at 1 PM new york time (whether that is UTC-5 or UTC-4) It would be nice not to have change that twice a year, like i do now. |
Alright, I think I've confused myself a bit on this, so I'm going to start from scratch. I observe the following:
An important implication of this is that scheduled jobs should fail to run during a DST lost hour if you are running a server that uses a daylight savings-sensitive timezone. In my understanding, this is the behavior you would expect from cron itself. Additionally, I don't like the idea of being able to set a cron based on the browser's timezone. I think the server should be the one true source of time. Given these goals, I think we should do the following:
Thoughts? |
I think that the most flexible solution with not that much pain is to decouple Dagobah from server time zone. On various linux distributions it is possible to tell cron what time zone to use when interpreting a cron string by setting the If you agree with the above the an argument can be made to set the timezone as a config, and force all jobs to use that but i really think to offer maximum flexibility that it should be a job specific thing. It fits in with the current plans to make jobs very flexible. In either case in the schedule method of Job you would do something like, assuming you have a self.timezone or config.timezone (let just call it job_tz)
|
Closes #46
@rclough any objections?
@Creator11 can you give this another go? I had no problems creating jobs with this branch, are you able to do so with current master? I think maybe you've got a separate config issue.