ecerulm commented on issue #16551:
URL: https://github.com/apache/airflow/issues/16551#issuecomment-866185162


   So it seems that currently the requirements for the `dag.timezone` are
   * it has to have a `name` attribute , so it must be a 
`pendulum.tz.timezone.*`
   * It has to have a `name`  that resolve to a "named timezone" like 
(`Europe/Stockholm`, `UTC`, etc)  and it can't be a FixedOffset like `+00:00`,  
this show in serialization/deserialization for example. You can serialize the 
dag but it won't be able to deserialize because it can parse back the `+00:00` 
timezone. (It will eventually call `pendulum.tz.timezone('+00:00')` and that 
raises `InvalidTimezone`
   
   So I don't know, I can sure make it work for `tzinfo=timezone.utc` but not 
all `tzinfo` can be converted to a "named timezone". 
   
   What I can do it's to do a fail-fast approach in `DAG.__init__()` by doing 
the `self.timezone = pendulum.timezone(self.timezone.name)` there instead of 
waiting until `following_schedule`, `previous_schedule` or a deserialization to 
occur. 
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to