-
Notifications
You must be signed in to change notification settings - Fork 192
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
profile setup fails due to invalid timezone #3563
Comments
Haha, it seems we need to add a travis battery of tests that proxies to the US before running. Also, interestingly enough, we have a tag for sqlalchemy but not one for django. Should I create it? |
Please go ahead! |
Isn't what this link suggests to set |
According to this paragraph Since |
Ah, right ;-) Of course, that's also what we did to work around this.
Thanks a lot for taking the time to look into this!
Sounds reasonable to me - perhaps together with printing a warning?
Ok, we should check. |
Yeah, if it's in interactive mode we can just ask something like "Time stamps will be inaccurate. Are you sure you want to continue?"
It seems running
From the comment (see below) I'd say
|
Looking at the implementation of tzlocal, it turns out that As discussed with @sphuber , one solution is to actually delete this setting
since it only configures how django displays datetime objects; a functionality that we don't use in AiiDA. Mocking the def get_current_timezone():
import pytz
with open('/etc/localtime', 'rb') as handle:
tz = pytz.tzfile.build_tzinfo('local', handle)
return tz reveals that two more tests fail:
I'll look into whether those can be fixed as well. |
While one test was easy to fix, it turns out that what we are doing here aiida-core/aiida/common/timezone.py Line 74 in cc94a1e
is actually not guaranteed to work in general (only for timezones without daylight saving transitions). For example, on my machine
but creating a pytz timezone object from
So, somehow I don't think it's my job to fix this, so I will be adding a warning when the timezone returned by |
To summarize - in the end, there was an issue with deleting the timezone setting from django, since django uses the value provided there (or the default, i.e. The value of this variable is, in turn, used by As explained here, there might be a way to get around this by manually configuring django, but this involves passing all settings from the So, in conclusion, for the moment the solution is to throw an exception when tzlocal returns a |
On the Midway cluster at the University of Chicago, it turns out that this code
aiida-core/aiida/common/timezone.py
Lines 24 to 25 in cc94a1e
returns a timezone called
local
which when passed hereaiida-core/aiida/backends/djsite/settings.py
Line 72 in 6299cf6
gives rise to an error
when the django migrations are running.
We should look into why django and tzlocal seem to have a different idea of which timezones are allowed, and whether we can provide a fallback (or a suggestion to fix it) so that profile setup does not simply fail.
Note:
export TIME_ZONE='America/Chicago'
as suggested here did not helpThe text was updated successfully, but these errors were encountered: