dimberman commented on a change in pull request #15330:
URL: https://github.com/apache/airflow/pull/15330#discussion_r707646679
##########
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 I think we can kick the can on this. For now there will be all of
zero decorators that will be loaded in this case. I think we can reasonably
assume that we're not going to see a flood of custom decorators in the near
future. This can be a 2.2.1 feature etc.
--
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]