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/02/28 13:19:59 UTC

[GitHub] [airflow] ashb commented on a change in pull request #21815: Ensure a mappable operator's deps is a set, and convert BaseSensorOperator.deps to a class variable

ashb commented on a change in pull request #21815:
URL: https://github.com/apache/airflow/pull/21815#discussion_r815881591



##########
File path: airflow/models/mappedoperator.py
##########
@@ -284,7 +285,10 @@ def get_serialized_fields(cls):
     @staticmethod
     @cache
     def deps_for(operator_class: Type["BaseOperator"]) -> FrozenSet[BaseTIDep]:
-        return operator_class.deps | {MappedTaskIsExpanded()}
+        operator_deps = operator_class.deps
+        if not isinstance(operator_deps, collections.abc.Set):
+            raise UnmappableOperator(f"cannot map operator; f{operator_class}.deps must be a set")

Review comment:
       Can we be more explicit here -- if it is defined as a property to tell the user what is wrong as this could easily be confusing to the user if they have it as:
   
   ```python
       @property
       def deps(self):
          return {MyDep()}
   ```
   
   Because at first glance this _is_ a set.




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