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_r354899097
##########
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:
We should probably add this to our JSON Schema. Something like this is the
part of the schema we want for op_links:
```json
{ "type": "array",
"items": {
"type": "object",
"minProperties": 1,
"maxProperties": 1
}
}
```
----------------------------------------------------------------
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