-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Description
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'}forui_issue.push_to_xcom.
- The DAG Run List UI should break, and the XCom List UI should show a value of
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
- I agree to follow this project's Code of Conduct