michaelm6y opened a new issue #13244:
URL: https://github.com/apache/airflow/issues/13244


   **Apache Airflow version**: 2.0
   
   
   **Kubernetes version (if you are using kubernetes)** (use `kubectl 
version`): N/A
   
   **Environment**:
   
   - **Cloud provider or hardware configuration**: Local
   - **OS** (e.g. from /etc/os-release): Mac
   - **Kernel** (e.g. `uname -a`):
   - **Install tools**:
   - **Others**:
   
   **What happened**:
   
   Scheduler and webserver crash when a DAG doesn't have a timezone associated 
with the schedule start time:
   Traceback (most recent call last):
     File 
"/usr/local/lib/python3.7/site-packages/pendulum/tz/zoneinfo/reader.py", line 
50, in read_for
       file_path = pytzdata.tz_path(timezone)
     File "/usr/local/lib/python3.7/site-packages/pytzdata/__init__.py", line 
74, in tz_path
       raise TimezoneNotFound('Timezone {} not found at {}'.format(name, 
filepath))
   pytzdata.exceptions.TimezoneNotFound: Timezone 
psycopg2.tz.FixedOffsetTimezone(offset=0, name=None) not found at 
/usr/local/lib/python3.7/site-packages/pytzdata/zoneinfo/psycopg2.tz.FixedOffsetTimezone(offset=0,
 name=None)
   
   Scheduler crashes automatically, webserver works until you click on the DAG, 
at which time you get an error message until you refresh.
   
   **What you expected to happen**:
   
   DAG either shouldn't validate, or these services should assume UTC.
   
   **How to reproduce it**:
   add a schedule start time with this tz info:
   psycopg2.tz.FixedOffsetTimezone(offset=0, name=None)
   
   
   **Anything else we need to know**:
   
   Something bad has happened.
   Please consider letting us know by creating a bug report using GitHub.
   
   Python version: 3.7.4
   Airflow version: 2.0.0
   Node: 07133b527903
   
-------------------------------------------------------------------------------
   Traceback (most recent call last):
     File 
"/usr/local/lib/python3.7/site-packages/pendulum/tz/zoneinfo/reader.py", line 
50, in read_for
       file_path = pytzdata.tz_path(timezone)
     File "/usr/local/lib/python3.7/site-packages/pytzdata/__init__.py", line 
74, in tz_path
       raise TimezoneNotFound('Timezone {} not found at {}'.format(name, 
filepath))
   pytzdata.exceptions.TimezoneNotFound: Timezone 
psycopg2.tz.FixedOffsetTimezone(offset=0, name=None) not found at 
/usr/local/lib/python3.7/site-packages/pytzdata/zoneinfo/psycopg2.tz.FixedOffsetTimezone(offset=0,
 name=None)
   
   During handling of the above exception, another exception occurred:
   
   Traceback (most recent call last):
     File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2447, in 
wsgi_app
       response = self.full_dispatch_request()
     File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1952, in 
full_dispatch_request
       rv = self.handle_user_exception(e)
     File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1821, in 
handle_user_exception
       reraise(exc_type, exc_value, tb)
     File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, 
in reraise
       raise value
     File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1950, in 
full_dispatch_request
       rv = self.dispatch_request()
     File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1936, in 
dispatch_request
       return self.view_functions[rule.endpoint](**req.view_args)
     File "/usr/local/lib/python3.7/site-packages/airflow/www/auth.py", line 
34, in decorated
       return func(*args, **kwargs)
     File "/usr/local/lib/python3.7/site-packages/airflow/www/decorators.py", 
line 97, in view_func
       return f(*args, **kwargs)
     File "/usr/local/lib/python3.7/site-packages/airflow/www/decorators.py", 
line 60, in wrapper
       return f(*args, **kwargs)
     File "/usr/local/lib/python3.7/site-packages/airflow/www/views.py", line 
1861, in tree
       dag = current_app.dag_bag.get_dag(dag_id)
     File "/usr/local/lib/python3.7/site-packages/airflow/utils/session.py", 
line 65, in wrapper
       return func(*args, session=session, **kwargs)
     File "/usr/local/lib/python3.7/site-packages/airflow/models/dagbag.py", 
line 171, in get_dag
       self._add_dag_from_db(dag_id=dag_id, session=session)
     File "/usr/local/lib/python3.7/site-packages/airflow/models/dagbag.py", 
line 229, in _add_dag_from_db
       dag = row.dag
     File 
"/usr/local/lib/python3.7/site-packages/airflow/models/serialized_dag.py", line 
167, in dag
       dag = SerializedDAG.from_dict(self.data)  # type: Any
     File 
"/usr/local/lib/python3.7/site-packages/airflow/serialization/serialized_objects.py",
 line 719, in from_dict
       return cls.deserialize_dag(serialized_obj['dag'])
     File 
"/usr/local/lib/python3.7/site-packages/airflow/serialization/serialized_objects.py",
 line 655, in deserialize_dag
       v = cls._deserialize_timezone(v)
     File "/usr/local/lib/python3.7/site-packages/pendulum/tz/__init__.py", 
line 37, in timezone
       tz = _Timezone(name, extended=extended)
     File "/usr/local/lib/python3.7/site-packages/pendulum/tz/timezone.py", 
line 40, in __init__
       tz = read(name, extend=extended)
     File 
"/usr/local/lib/python3.7/site-packages/pendulum/tz/zoneinfo/__init__.py", line 
9, in read
       return Reader(extend=extend).read_for(name)
     File 
"/usr/local/lib/python3.7/site-packages/pendulum/tz/zoneinfo/reader.py", line 
52, in read_for
       raise InvalidTimezone(timezone)
   pendulum.tz.zoneinfo.exceptions.InvalidTimezone: Invalid timezone 
"psycopg2.tz.FixedOffsetTimezone(offset=0, name=None)"
   


----------------------------------------------------------------
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