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 2022/01/04 19:26:09 UTC

[GitHub] [airflow] turbaszek commented on a change in pull request #20530: Add sensor decorator

turbaszek commented on a change in pull request #20530:
URL: https://github.com/apache/airflow/pull/20530#discussion_r778333159



##########
File path: airflow/decorators/__init__.py
##########
@@ -29,9 +30,11 @@ def __getattr__(self, name):
         if name.startswith("__"):
             raise AttributeError(f'{type(self).__name__} has no attribute {name!r}')
         decorators = ProvidersManager().taskflow_decorators
-        if name not in decorators:
-            raise AttributeError(f"task decorator {name!r} not found")
-        return decorators[name]
+        if name in decorators:
+            return decorators[name]
+        if name == "sensor":
+            return sensor

Review comment:
       Can provider implement `sensor` decorator? If yes in that case that one will be used. I'm wondering if we should not initialise `ProviderManager` with `_taskflow_decorators` that would include predefined builtin decorators (or add builtins in the same way)?  In this way we may probably use only one mechanism of registering decorators and skip mixin approach.
   




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