You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/09/21 01:44:47 UTC
[GitHub] [airflow] gfeldman opened a new pull request, #26546: reverting json setting to use json_encoder despite warnings
gfeldman opened a new pull request, #26546:
URL: https://github.com/apache/airflow/pull/26546
closes: 26527
The `flask_app.json_provider_class` does not take a JsonEncoder as an argument. Reverting the setting to `flask_app.json_encoder` despite deprecation warnings until a provider can be written.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] gfeldman commented on pull request #26546: reverting json setting to use json_encoder despite warnings
Posted by GitBox <gi...@apache.org>.
gfeldman commented on PR #26546:
URL: https://github.com/apache/airflow/pull/26546#issuecomment-1253113679
with `flask_app.json_encoder = AirflowJsonEncoder` setting
```
>>> from airflow.www import app
>>> from kubernetes.client import models as k8s
>>> p = k8s.V1Pod(spec=k8s.V1PodSpec(containers=[k8s.V1Container(name="base")]))
>>> c = app.create_app()
>>> c.json.dumps(p)
'{"spec": {"containers": [{"name": "base"}]}}'
```
with `flask_app.json_provider_class = AirflowJsonEncoder`
```
>>> from airflow.www import app
>>> from kubernetes.client import models as k8s
>>> p = k8s.V1Pod(spec=k8s.V1PodSpec(containers=[k8s.V1Container(name="base")]))
>>> c = app.create_app()
>>> c.json.dumps(p)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/guy.feldman/opt/anaconda3/lib/python3.9/site-packages/flask/json/provider.py", line 230, in dumps
return json.dumps(obj, **kwargs)
File "/Users/guy.feldman/opt/anaconda3/lib/python3.9/json/__init__.py", line 234, in dumps
return cls(
File "/Users/guy.feldman/opt/anaconda3/lib/python3.9/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/Users/guy.feldman/opt/anaconda3/lib/python3.9/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/Users/guy.feldman/opt/anaconda3/lib/python3.9/site-packages/flask/json/provider.py", line 122, in _default
raise TypeError(f"Object of type {type(o).__name__} is not JSON serializable")
TypeError: Object of type V1Pod is not JSON serializable
```
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] ashb commented on pull request #26546: reverting json setting to use json_encoder despite warnings
Posted by GitBox <gi...@apache.org>.
ashb commented on PR #26546:
URL: https://github.com/apache/airflow/pull/26546#issuecomment-1253594846
This fix is incorrect, `json_encoder` is now deprecated in Flask 2.2 and will be removed in flask 2.3
https://flask.palletsprojects.com/en/2.2.x/api/?highlight=json_provider_class#flask.Flask.json_encoder
So we'll need to find a different fix.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] ashb closed pull request #26546: reverting json setting to use json_encoder despite warnings
Posted by GitBox <gi...@apache.org>.
ashb closed pull request #26546: reverting json setting to use json_encoder despite warnings
URL: https://github.com/apache/airflow/pull/26546
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] boring-cyborg[bot] commented on pull request #26546: reverting json setting to use json_encoder despite warnings
Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on PR #26546:
URL: https://github.com/apache/airflow/pull/26546#issuecomment-1253104357
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
Here are some useful points:
- Pay attention to the quality of your code (flake8, mypy and type annotations). Our [pre-commits]( https://github.com/apache/airflow/blob/main/STATIC_CODE_CHECKS.rst#prerequisites-for-pre-commit-hooks) will help you with that.
- In case of a new feature add useful documentation (in docstrings or in `docs/` directory). Adding a new operator? Check this short [guide](https://github.com/apache/airflow/blob/main/docs/apache-airflow/howto/custom-operator.rst) Consider adding an example DAG that shows how users should use it.
- Consider using [Breeze environment](https://github.com/apache/airflow/blob/main/BREEZE.rst) for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
- Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
- Please follow [ASF Code of Conduct](https://www.apache.org/foundation/policies/conduct) for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
- Be sure to read the [Airflow Coding style]( https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#coding-style-and-best-practices).
Apache Airflow is a community-driven project and together we are making it better 🚀.
In case of doubts contact the developers at:
Mailing List: dev@airflow.apache.org
Slack: https://s.apache.org/airflow-slack
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] ashb commented on pull request #26546: reverting json setting to use json_encoder despite warnings
Posted by GitBox <gi...@apache.org>.
ashb commented on PR #26546:
URL: https://github.com/apache/airflow/pull/26546#issuecomment-1253626453
Closing in favour of #26554. Thank you for the debugging steps, they made it very easy for me to fix.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org