You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/09/13 04:37:58 UTC

[GitHub] [airflow] dimberman commented on a change in pull request #15330: Add a Docker Taskflow decorator

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



##########
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:
       @potiuk did you ever make a refactor for this? If not I'd like to figure out a way we can defer this issue so we can get this merged.




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org