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 2020/05/20 05:13:20 UTC

[GitHub] [airflow] j-y-matsubara commented on a change in pull request #8867: Add argument to BaseSensorOperator to make respect the trigger_rule in downstream tasks.

j-y-matsubara commented on a change in pull request #8867:
URL: https://github.com/apache/airflow/pull/8867#discussion_r427745336



##########
File path: airflow/sensors/base_sensor_operator.py
##########
@@ -131,6 +134,19 @@ def execute(self, context: Dict) -> Any:
                 try_number += 1
         self.log.info("Success criteria met. Exiting.")
 
+    def _timeout_task(self, context: Dict) -> None:
+        # If sensor is in soft fail mode but will be retried then
+        # give it a chance and fail with timeout.
+        # This gives the ability to set up non-blocking AND soft-fail sensors.
+        if self.soft_fail and not context['ti'].is_eligible_to_retry():
+            if self.downstream_skip:
+                self._do_skip_downstream_tasks(context)
+            raise AirflowSkipException('Snap. Time is OUT.')
+        else:
+            if self.downstream_skip and not context['ti'].is_eligible_to_retry():
+                self._do_skip_downstream_tasks(context)
+            raise AirflowSensorTimeout('Snap. Time is OUT.')

Review comment:
       Thank you your comments, @yuqian90 .
   
   >It is changing the original behaviour even when user sets downstream_skip=True. 
   Yes.
   When setting downstream_skip=False or not setting downstream_skip, then not changing the original behaviour.
   
   The reason I made this change is that :  
   I wasn't sure if "downstream_skip" can be added as an argument that **only works when soft_fail is set to true.**
   
   Therefore, I don't disagree with your opinion.
   >I can't think of any scenario that will be a useful behaviour.
   
   I will fixe it.
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   




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

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