tirkarthi opened a new issue, #22969: URL: https://github.com/apache/airflow/issues/22969
### Apache Airflow version 2.2.5 (latest released) ### What happened Invalid execution_date in query parameter will crash durations page since pendulum parsing exception is not handled in several views ### What you think should happen instead On `ParseError` the page should resort to some default value like in grid page or show an error flash message instead of crash. ### How to reproduce 1. Visit a dag duration page with invalid date in URL : http://localhost:8080/dags/raise_exception/duration?days=30&root=&num_runs=25&base_date=2022-04-12+16%3A29%3A21%2B05%3A30er 2. Stacktrace ```python Python version: 3.10.4 Airflow version: 2.3.0.dev0 Node: laptop ------------------------------------------------------------------------------- Traceback (most recent call last): File "/home/karthikeyan/stuff/python/airflow/.env/lib/python3.10/site-packages/pendulum/parsing/__init__.py", line 131, in _parse dt = parser.parse( File "/home/karthikeyan/stuff/python/airflow/.env/lib/python3.10/site-packages/dateutil/parser/_parser.py", line 1368, in parse return DEFAULTPARSER.parse(timestr, **kwargs) File "/home/karthikeyan/stuff/python/airflow/.env/lib/python3.10/site-packages/dateutil/parser/_parser.py", line 643, in parse raise ParserError("Unknown string format: %s", timestr) dateutil.parser._parser.ParserError: Unknown string format: 2022-04-12 16:29:21+05:30er During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/karthikeyan/stuff/python/airflow/.env/lib/python3.10/site-packages/flask/app.py", line 2447, in wsgi_app response = self.full_dispatch_request() File "/home/karthikeyan/stuff/python/airflow/.env/lib/python3.10/site-packages/flask/app.py", line 1952, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/karthikeyan/stuff/python/airflow/.env/lib/python3.10/site-packages/flask/app.py", line 1821, in handle_user_exception reraise(exc_type, exc_value, tb) File "/home/karthikeyan/stuff/python/airflow/.env/lib/python3.10/site-packages/flask/_compat.py", line 39, in reraise raise value File "/home/karthikeyan/stuff/python/airflow/.env/lib/python3.10/site-packages/flask/app.py", line 1950, in full_dispatch_request rv = self.dispatch_request() File "/home/karthikeyan/stuff/python/airflow/.env/lib/python3.10/site-packages/flask/app.py", line 1936, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/home/karthikeyan/stuff/python/airflow/airflow/www/auth.py", line 40, in decorated return func(*args, **kwargs) File "/home/karthikeyan/stuff/python/airflow/airflow/www/decorators.py", line 80, in wrapper return f(*args, **kwargs) File "/home/karthikeyan/stuff/python/airflow/airflow/utils/session.py", line 71, in wrapper return func(*args, session=session, **kwargs) File "/home/karthikeyan/stuff/python/airflow/airflow/www/views.py", line 2870, in duration base_date = timezone.parse(base_date) File "/home/karthikeyan/stuff/python/airflow/airflow/utils/timezone.py", line 205, in parse return pendulum.parse(string, tz=timezone or TIMEZONE, strict=False) # type: ignore File "/home/karthikeyan/stuff/python/airflow/.env/lib/python3.10/site-packages/pendulum/parser.py", line 29, in parse return _parse(text, **options) File "/home/karthikeyan/stuff/python/airflow/.env/lib/python3.10/site-packages/pendulum/parser.py", line 45, in _parse parsed = base_parse(text, **options) File "/home/karthikeyan/stuff/python/airflow/.env/lib/python3.10/site-packages/pendulum/parsing/__init__.py", line 74, in parse return _normalize(_parse(text, **_options), **_options) File "/home/karthikeyan/stuff/python/airflow/.env/lib/python3.10/site-packages/pendulum/parsing/__init__.py", line 135, in _parse raise ParserError("Invalid date string: {}".format(text)) pendulum.parsing.exceptions.ParserError: Invalid date string: 2022-04-12 16:29:21+05:30er ``` ### Operating System Ubuntu 20.04 ### Versions of Apache Airflow Providers _No response_ ### Deployment Virtualenv installation ### Deployment details _No response_ ### Anything else _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md) -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
