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/08/08 11:05:46 UTC

[GitHub] [airflow] uranusjr commented on a diff in pull request #25594: Fix mapped sensor with reschedule mode

uranusjr commented on code in PR #25594:
URL: https://github.com/apache/airflow/pull/25594#discussion_r940113016


##########
airflow/models/mappedoperator.py:
##########
@@ -383,6 +386,13 @@ def inherits_from_empty_operator(self) -> bool:
         """Implementing Operator."""
         return self._is_empty
 
+    @property
+    def reschedule(self) -> bool:
+        """Check if the operator is a sensor and has mode reschedule"""
+        if self._is_sensor:
+            return self.partial_kwargs['mode'] == 'reschedule'
+        raise AttributeError("reschedule is not defined for MappedOperator")
+

Review Comment:
   Would it be easier if we just make `reschedule` a separate attribute, and calculate that when a MappedOperator is created? This seem easier than adding a new `_is_sensor` that does not exist on BaseOperator.



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