vincbeck commented on code in PR #44797: URL: https://github.com/apache/airflow/pull/44797#discussion_r1880773387
########## airflow/dag_processing/collection.py: ########## @@ -547,3 +547,19 @@ def add_asset_trigger_references( def _encrypt_trigger_kwargs(trigger: BaseTrigger) -> tuple[str, str]: classpath, kwargs = trigger.serialize() return classpath, Trigger.encrypt_kwargs(kwargs) + + @staticmethod + def _get_trigger_hash(classpath: str, kwargs: dict[str, Any]) -> int: + """ + Return the hash of the trigger classpath and kwargs. This is used to uniquely identify a trigger. + + We do not want to move this logic in a `__hash__` method in `BaseTrigger` because we do not want to + make the triggers hashable. The reason being, when the triggerer retrieve the list of triggers, we do + not want it dedupe them. When used to defer tasks, 2 triggers can have the same classpath and kwargs. + This is not true for event driven scheduling. + """ + return hash((classpath, frozenset(kwargs.items()))) Review Comment: After discussion with @dstandish, we decided (and thanks again for pointing out the solution Dan) to serialize `kwargs` (this is already done because we are storing these kwargs in the DB) and then hash 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. To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org