yilinlesley opened a new issue, #35630:
URL: https://github.com/apache/airflow/issues/35630

   ### Apache Airflow version
   
   Other Airflow 2 version (please specify below)
   
   ### What happened
   
   This happened while I was testing the customized timetable. When I tried to 
click on the DAG in Airflow UI, it jumped straight to this error page below:
   
![image](https://github.com/apache/airflow/assets/135854384/de8eea03-c085-4107-8993-f4a45704d258)
   Complete error message is as below:
   `Something bad has happened.
   
   Airflow is used by many users, and it is very likely that others had similar 
problems and you can easily find
   a solution to your problem.
   
   Consider following these steps:
   
     * gather the relevant information (detailed logs with errors, reproduction 
steps, details of your deployment)
   
     * find similar issues using:
        * [GitHub Discussions](https://github.com/apache/airflow/discussions)
        * [GitHub Issues](https://github.com/apache/airflow/issues)
        * [Stack Overflow](https://stackoverflow.com/questions/tagged/airflow)
        * the usual search engine you use on a daily basis
   
     * if you run Airflow on a Managed Service, consider opening an issue using 
the service support channels
   
     * if you tried and have difficulty with diagnosing and fixing the problem 
yourself, consider creating a [bug 
report](https://github.com/apache/airflow/issues/new/choose).
       Make sure however, to include all relevant details and results of your 
investigation so far.
   
   Python version: 3.9.7
   Airflow version: 2.7.1
   Node: airflowtest
   
-------------------------------------------------------------------------------
   Traceback (most recent call last):
     File "/home/airflow/.local/lib/python3.9/site-packages/flask/app.py", line 
2529, in wsgi_app
       response = self.full_dispatch_request()
     File "/home/airflow/.local/lib/python3.9/site-packages/flask/app.py", line 
1825, in full_dispatch_request
       rv = self.handle_user_exception(e)
     File "/home/airflow/.local/lib/python3.9/site-packages/flask/app.py", line 
1823, in full_dispatch_request
       rv = self.dispatch_request()
     File "/home/airflow/.local/lib/python3.9/site-packages/flask/app.py", line 
1799, in dispatch_request
       return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
     File 
"/home/airflow/.local/lib/python3.9/site-packages/airflow/www/auth.py", line 
53, in decorated
       return func(*args, **kwargs)
     File 
"/home/airflow/.local/lib/python3.9/site-packages/airflow/www/decorators.py", 
line 168, in view_func
       return f(*args, **kwargs)
     File 
"/home/airflow/.local/lib/python3.9/site-packages/airflow/www/decorators.py", 
line 127, in wrapper
       return f(*args, **kwargs)
     File 
"/home/airflow/.local/lib/python3.9/site-packages/airflow/utils/session.py", 
line 77, in wrapper
       return func(*args, session=session, **kwargs)
     File 
"/home/airflow/.local/lib/python3.9/site-packages/airflow/www/views.py", line 
2919, in grid
       dag = get_airflow_app().dag_bag.get_dag(dag_id, session=session)
     File 
"/home/airflow/.local/lib/python3.9/site-packages/airflow/utils/session.py", 
line 74, in wrapper
       return func(*args, **kwargs)
     File 
"/home/airflow/.local/lib/python3.9/site-packages/airflow/models/dagbag.py", 
line 190, in get_dag
       self._add_dag_from_db(dag_id=dag_id, session=session)
     File 
"/home/airflow/.local/lib/python3.9/site-packages/airflow/models/dagbag.py", 
line 272, in _add_dag_from_db
       dag = row.dag
     File 
"/home/airflow/.local/lib/python3.9/site-packages/airflow/models/serialized_dag.py",
 line 221, in dag
       return SerializedDAG.from_dict(data)
     File 
"/home/airflow/.local/lib/python3.9/site-packages/airflow/serialization/serialized_objects.py",
 line 1406, in from_dict
       return cls.deserialize_dag(serialized_obj["dag"])
     File 
"/home/airflow/.local/lib/python3.9/site-packages/airflow/serialization/serialized_objects.py",
 line 1342, in deserialize_dag
       v = _decode_timetable(v)
     File 
"/home/airflow/.local/lib/python3.9/site-packages/airflow/serialization/serialized_objects.py",
 line 210, in _decode_timetable
       raise _TimetableNotRegistered(importable_string)
   airflow.serialization.serialized_objects._TimetableNotRegistered: Timetable 
class 'uneven_intervals_timetable.UnevenIntervalsTimetable' is not registered 
or you have a top level database access that disrupted the session. Please 
check the airflow best practices documentation.`
   
   Everything else is fine. Without clicking on the DAG, the timetable is 
functioning normally with showing the RUN_AFTER & run on the scheduled time. 
This error page only shows up when I try to click into the DAG.
   
   ### What you think should happen instead
   
   _No response_
   
   ### How to reproduce
   
   I was testing the unevenintervals timetable whose source code is listed 
here: **https://github.com/astronomer/airflow-scheduling-tutorial**
    And here is my DAG:
   `from airflow import DAG
   from uneven_intervals_timetable import UnevenIntervalsTimetable
   from airflow.timetables.events import EventsTimetable
   from airflow.operators.python import PythonOperator
   from datetime import datetime, timedelta
   # from dateutil.relativedelta import relativedelta
   from airflow.operators.empty import EmptyOperator
   import pendulum
   from airflow import plugins_manager
   
   plugins_manager.initialize_timetables_plugins()
   default_args = {
       "owner": "someone",
       "email": ["[email protected]"],
       "email_on_failure": True,
       "email_on_retry": True,
       "retries": 1,
       "retry_delay": timedelta(minutes=1),
   }
   
   with DAG(
       dag_id="test_uneven_intervals_timetable_dag",
       default_args=default_args,
       description="DAG to test timetables3",
   
       start_date=datetime(2023, 11, 6),
       timetable=UnevenIntervalsTimetable(),
       catchup=False,
       tags=["timetable"],
       params={"key": "", "email": "[email protected]"},
   ) as dag:
       start_test = EmptyOperator(task_id="start_test")
   
       python_task = PythonOperator(
           task_id="python_task",
           python_callable=lambda: print(plugins_manager.timetable_classes),
       )
       
       start_test >> python_task`
   
   ### Operating System
   
   CentOS Linux
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Other
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] 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]

Reply via email to