dimberman commented on a change in pull request #15330:
URL: https://github.com/apache/airflow/pull/15330#discussion_r694154586



##########
File path: airflow/providers_manager.py
##########
@@ -278,6 +309,51 @@ def _get_attr(obj: Any, attr_name: str):
             return None
         return getattr(obj, attr_name)
 
+    def _add_taskflow_decorator(
+        self, decorator_name, decorator_class_name: str, provider_package: str
+    ) -> None:
+        if provider_package.startswith("apache-airflow"):
+            provider_path = provider_package[len("apache-") :].replace("-", 
".")
+            if not decorator_class_name.startswith(provider_path):
+                log.warning(
+                    "Sanity check failed when importing '%s' from '%s' 
package. It should start with '%s'",
+                    decorator_class_name,
+                    provider_package,
+                    provider_path,
+                )
+                return
+        if decorator_name in self._taskflow_decorator_dict:
+            log.warning(
+                "The hook_class '%s' has been already registered.",
+                decorator_class_name,
+            )
+            return
+        try:
+            module, class_name = decorator_class_name.rsplit('.', maxsplit=1)
+            decorator_class = getattr(importlib.import_module(module), 
class_name)
+            self._taskflow_decorator_dict[decorator_name] = decorator_class

Review comment:
       @ashb so is this something that should be addressed in this PR or 
another? As it stands there won't be many (if any) decorators to import, so 
maybe we can defer?




-- 
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]


Reply via email to