suiting-young commented on a change in pull request #14827:
URL: https://github.com/apache/airflow/pull/14827#discussion_r595022187
##########
File path: airflow/models/xcom.py
##########
@@ -233,32 +227,25 @@ def serialize_value(value: Any):
return json.dumps(value).encode('UTF-8')
except (ValueError, TypeError):
log.error(
- "Could not serialize the XCom value into JSON. "
- "If you are using pickles instead of JSON "
- "for XCom, then you need to enable pickle "
- "support for XCom in your airflow config."
+ "Could not serialize the XCom value into JSON."
+ " If you are using pickles instead of JSON for XCom,"
+ " then you need to enable pickle support for XCom"
+ " in your airflow config."
)
raise
@staticmethod
def deserialize_value(result: "XCom") -> Any:
"""Deserialize XCom value from str or pickle object"""
- enable_pickling = conf.getboolean('core', 'enable_xcom_pickling')
- if enable_pickling:
+ if not conf.getboolean('core', 'enable_xcom_pickling'):
try:
- return pickle.loads(result.value)
- except pickle.UnpicklingError:
return json.loads(result.value.decode('UTF-8'))
- try:
- return json.loads(result.value.decode('UTF-8'))
- except JSONDecodeError:
- log.error(
- "Could not deserialize the XCom value from JSON. "
- "If you are using pickles instead of JSON "
- "for XCom, then you need to enable pickle "
- "support for XCom in your airflow config."
- )
Review comment:
This message is meaningless here, as user can do nothing with values
already existing in database.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]