its-amann commented on code in PR #77087:
URL: https://github.com/apache/airflow/pull/77087#discussion_r4578408508


##########
airflow-core/src/airflow/jobs/triggerer_job_runner.py:
##########
@@ -1249,7 +1279,17 @@ def update_triggers(self, requested_trigger_ids: 
set[int]):
         )
 
         if new_trigger_ids:
-            workloads_to_create = self.build_trigger_workloads(new_trigger_ids)
+            now = time.monotonic()
+            ready_ids = {tid for tid in new_trigger_ids if 
self.failure_tracker.attempt_ready(tid, now)}

Review Comment:
   this check runs before continue_from, which only gets called later in 
_create_workload. so when a fresh triggerer picks up a trigger that already has 
consecutive_failures on the row (restart or handover), it gets created right 
away and the backoff never kicks in. test_continue_from_backs_off_immediately 
only checks the tracker on its own so it doesn't catch this.
   
   loading the row count before building fixes it, in build_trigger_workloads:
   ```diff
                    new_trigger_orm = new_triggers[new_trigger_id]
   
   +                self.failure_tracker.continue_from(new_trigger_id, 
new_trigger_orm.consecutive_failures)
   +                if not self.failure_tracker.attempt_ready(new_trigger_id, 
time.monotonic()):
   +                    continue
   +
   ```
   
   fixed this plus a test in this commit, you can just cherry pick it instead 
of redoing it: 
https://github.com/its-amann/airflow/commit/6faa9e381d27305cd4e20e8eab36abd64bd4c23b



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