vandonr-amz commented on code in PR #28528:
URL: https://github.com/apache/airflow/pull/28528#discussion_r1060919906


##########
airflow/sensors/base.py:
##########
@@ -256,14 +256,13 @@ def _get_next_poke_interval(
         return new_interval
 
     def prepare_for_execution(self) -> BaseOperator:
-        task = super().prepare_for_execution()
         # Sensors in `poke` mode can block execution of DAGs when running
         # with single process executor, thus we change the mode to`reschedule`
         # to allow parallel task being scheduled and executed
         if conf.get("core", "executor") == "DebugExecutor":
             self.log.warning("DebugExecutor changes sensor mode to 
'reschedule'.")
-            task.mode = "reschedule"
-        return task
+            self.mode = "reschedule"

Review Comment:
   so, that's because the TaskInstance that goes through `ready_to_reschedule` 
is not the same as the one that does the prepare_for_execution, it's a clone 
that's reloaded from SQL, with the original unmodified task.



##########
airflow/sensors/base.py:
##########
@@ -256,14 +256,13 @@ def _get_next_poke_interval(
         return new_interval
 
     def prepare_for_execution(self) -> BaseOperator:
-        task = super().prepare_for_execution()
         # Sensors in `poke` mode can block execution of DAGs when running
         # with single process executor, thus we change the mode to`reschedule`
         # to allow parallel task being scheduled and executed
         if conf.get("core", "executor") == "DebugExecutor":
             self.log.warning("DebugExecutor changes sensor mode to 
'reschedule'.")
-            task.mode = "reschedule"
-        return task
+            self.mode = "reschedule"

Review Comment:
   so, that's because the TaskInstance that goes through `ready_to_reschedule` 
is not the same as the one that does the `prepare_for_execution`, it's a clone 
that's reloaded from SQL, with the original unmodified task.



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

Reply via email to