ashb commented on a change in pull request #6715: [AIRFLOW-5945] Make inbuilt
OperatorLinks work when using Serialization
URL: https://github.com/apache/airflow/pull/6715#discussion_r354900317
##########
File path: airflow/serialization/serialized_objects.py
##########
@@ -354,6 +370,65 @@ def _is_excluded(cls, var: Any, attrname: str, op:
BaseOperator):
return True
return super()._is_excluded(var, attrname, op)
+ @classmethod
+ def _deserialize_operator_extra_links(
+ cls,
+ encoded_op_links: list
+ ) -> Dict[str, BaseOperatorLink]:
+ """
+ Deserialize Operator Links if the Classes are registered in Airflow
Plugins.
+ Error is raised if the OperatorLink is not found in Plugins too.
+
+ :param encoded_op_links: Serialized Operator Link
+ :return: De-Serialized Operator Link
+ """
+ from airflow.plugins_manager import registered_operator_link_classes
+
+ op_predefined_extra_links = {}
+
+ for _operator_links_source in encoded_op_links:
+ _operator_link_class, data =
list(_operator_links_source.items())[0]
Review comment:
This line took me a bit to work out what it's doing -- It modifies it in
place, but `_operator_link_class, data = _operator_links_source.popitem()`
works and is a bit clearer to me. What do you think?
(Don't know if that works for py2, which isn't a problem here but is when
backporting this)
----------------------------------------------------------------
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]
With regards,
Apache Git Services