TakawaAkirayo commented on code in PR #41232:
URL: https://github.com/apache/airflow/pull/41232#discussion_r1716590969


##########
airflow/jobs/triggerer_job_runner.py:
##########
@@ -751,3 +757,28 @@ def get_trigger_by_classpath(self, classpath: str) -> 
type[BaseTrigger]:
         if classpath not in self.trigger_cache:
             self.trigger_cache[classpath] = import_string(classpath)
         return self.trigger_cache[classpath]
+
+    @staticmethod
+    def add_trigger_cancel_reasons(
+        triggerer_id, cancel_trigger_ids: set[int]
+    ) -> list[tuple[int, TriggerTerminationReason]]:
+        """
+        Add trigger cancel reasons to give consumer more context.
+
+        Currently, we only distinguish between reassigned and other reasons.
+        """
+
+        def add_reason(
+            ids: set[int], reason: TriggerTerminationReason
+        ) -> list[tuple[int, TriggerTerminationReason]]:
+            return [(trigger_id, reason) for trigger_id in ids]
+
+        # find out reassigned triggers
+        reassigned_trigger_ids = 
set(Trigger.filter_out_reassigned_triggers(triggerer_id, cancel_trigger_ids))

Review Comment:
   You are right, already changed the method to return set directly now.



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