Taragolis commented on code in PR #28777:
URL: https://github.com/apache/airflow/pull/28777#discussion_r1063989966
##########
airflow/www/utils.py:
##########
@@ -133,13 +133,25 @@ def get_mapped_summary(parent_instance, task_instances):
def get_dag_run_conf(dag_run_conf: Any) -> tuple[str | None, bool]:
+ class DagRunConfEncoder(json.JSONEncoder):
+ def default(self, obj):
+ if isinstance(obj, bytes):
+ try:
+ return obj.decode()
+ except Exception:
+ return str(obj)
+ try:
+ return json.JSONEncoder.default(self, obj)
+ except Exception:
+ return str(obj)
Review Comment:
I'm not sure is this a good idea to convert everything to string
representation, personally I have no idea how users might use this values later
in case of binary data (or some specific classes)
```python
Python 3.9.10 (main, Feb 25 2022, 16:54:01)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.7.0 -- An enhanced Interactive Python. Type '?' for help.
PyDev console: using IPython 8.7.0
Python 3.9.10 (main, Feb 25 2022, 16:54:01)
[Clang 13.0.0 (clang-1300.0.29.30)] on darwin
import pickle
o = pickle.dumps({"a": 1, "b": 2})
str(o)
Out[4]:
"b'\\x80\\x04\\x95\\x11\\x00\\x00\\x00\\x00\\x00\\x00\\x00}\\x94(\\x8c\\x01a\\x94K\\x01\\x8c\\x01b\\x94K\\x02u.'"
```
It's look like we hide one error and postpone it into the later interaction.
--
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]