uranusjr commented on code in PR #68778:
URL: https://github.com/apache/airflow/pull/68778#discussion_r3449012639


##########
airflow-core/src/airflow/assets/manager.py:
##########
@@ -703,11 +727,25 @@ def _get_or_create_apdr(
                 )
                 return latest_apdr
 
+            is_refresh = False
+            if latest_apdr is not None:
+                # The latest APDR already fired, so this event re-arrives for 
an
+                # already-materialized window. Apply the rollup's rerun policy.
+                if rerun_policy is RerunPolicy.IGNORE:
+                    cls.logger().debug(
+                        "Dropping re-arrived event for fired window key %s 
dag_id %s (IGNORE)",
+                        target_key,
+                        target_dag.dag_id,
+                    )
+                    return None
+                is_refresh = rerun_policy is RerunPolicy.REFRESH

Review Comment:
   It’s probably better to make this a function on `RerunPolicy` instead, like 
this
   
   ```python
   if rerun_policy is None:
       is_refresh = False
   else:
       is_refresh = rerun_policy.is_refresh(target_dag, target_key)
   ```
   
   Furthermore, it is worth considering whether instead of *None*, we can add a 
dedicated `RerunPolicy.NONE` instead. This avoids needing to special-case 
*None* every time the value is used.



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