dstandish commented on a change in pull request #19505:
URL: https://github.com/apache/airflow/pull/19505#discussion_r784150880
##########
File path: airflow/models/xcom.py
##########
@@ -478,6 +489,27 @@ def orm_deserialize_value(self) -> Any:
return BaseXCom.deserialize_value(self)
+def serialize_value_shim(**kwargs):
+ """
+ Previously XCom.serialize_value only accepted one argument ``value``. In
order to give
+ custom XCom backends more flexibility with how they store values we now
forward to
+ ``XCom.serialize_value`` all params passed to ``XCom.set``. In order to
maintain
+ compatibility with XCom backends written with the old signature we need to
use this
+ compatibility shim, which forwards only those kwargs which are accepted by
the
+ XCom backend.
+ """
+ signature = inspect_function_arguments(XCom.serialize_value)
+ kwargs = {k: kwargs.get(k) for k in signature.bound_arguments}
+ if set(kwargs) == {'value'}:
+ warnings.warn(
+ f"Method `serialize_value` in XCom backend {XCom.__name__} is
using outdated signature and"
+ f"must be updated to accept all params in `BaseXCom.set` except
`session`.",
Review comment:
> I wonder if it makes sense to explicitly list out all the arguments,
or even check what arguments are missing and ask for them?
sure we can do that
--
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]