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

   ### Apache Airflow version
   
   2.5.0
   
   ### What happened
   
   When accessing `dag_run.conf` via a task's context, I was able to add a 
value that is non-JSON serializable. When I tried to access the Dag Run List UI 
(`/dagrun/list/`) or the Dag's Grid View, I was met with these error messages 
respectively:
   
   **Dag Run List UI**
   
   ```
   Ooops!
   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.
   ```
   
   **Grid View**
   
   ```
   Auto-refresh Error
   <!DOCTYPE html> <html lang="en"> <head> <link rel="stylesheet" 
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css";> 
</head> <body> <div class="container"> <h1> Ooops! </h1> <div> <pre> 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
   ```
   
   I was able to push the same value to XCom with 
`AIRFLOW__CORE__ENABLE_XCOM_PICKLING=True`, and the XCom List UI 
(`/xcom/list/`) did **not** throw an error.
   
   In the postgres instance I am using for the Airflow DB, both `dag_run.conf` 
& `xcom.value` have `BYTEA` types.
   
   ### What you think should happen instead
   
   Since we are able to add (and commit) a non-JSON serializable value into a 
Dag Run's conf, the UI should not break when trying to load this value. We 
could also ensure that one DAG Run's conf does not break the List UI for all 
Dag Runs (across all DAGs), and the DAG's Grid View.
   
   ### How to reproduce
   
   - Set `AIRFLOW__CORE__ENABLE_XCOM_PICKLING=True`
   - Trigger this DAG:
   ```
   import datetime
   from airflow.decorators import dag, task
   from airflow.models.xcom import XCom
   
   @dag(
       schedule_interval=None,
       start_date=datetime.datetime(2023, 1, 1),
   )
   def ui_issue():
   
       @task()
       def update_conf(**kwargs):
           dag_conf = kwargs["dag_run"].conf
           dag_conf["non_json_serializable_value"] = b"1234"
           print(dag_conf)
   
       @task()
       def push_to_xcom(**kwargs):
           dag_conf = kwargs["dag_run"].conf
           print(dag_conf)
           XCom.set(key="dag_conf", value=dag_conf, dag_id=kwargs["ti"].dag_id, 
task_id=kwargs["ti"].task_id, run_id=kwargs["ti"].run_id)
   
       return update_conf() >> push_to_xcom()
   
   
   dag = ui_issue()
   ```
   - View both the Dag Runs and XCom lists in the UI.
     - The DAG Run List UI should break, and the XCom List UI should show a 
value of `{'non_json_serializable_value': b'1234'}` for `ui_issue.push_to_xcom`.
   
   ### Operating System
   
   Debian Bullseye
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Astronomer
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   The XCom List UI was able to render this value. We could extend this 
capability to the DAG Run List UI.
   
   ### 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