ramziash commented on code in PR #74583:
URL: https://github.com/apache/airflow/pull/74583#discussion_r4693112415


##########
airflow-core/src/airflow/assets/manager.py:
##########
@@ -687,7 +691,24 @@ def _get_or_create_apdr(
         ``rollup_fingerprint`` is the serialized mapper / window definition 
for all partitioned
         assets in the timetable at creation time; the scheduler discards APDRs 
whose stamp no
         longer matches the current timetable's fingerprint (mapper / window 
may have changed).
+
+        When ``refire_policy`` is set and the latest APDR has already fired, 
sibling asset-key
+        logs are copied to the new APDR so a corrected event can satisfy the 
asset condition again.
         """
+        latest_apdr = None
+        if refire_policy is not None:
+            latest_apdr = session.scalar(
+                select(AssetPartitionDagRun)
+                .where(
+                    AssetPartitionDagRun.partition_key == target_key,
+                    AssetPartitionDagRun.target_dag_id == target_dag.dag_id,
+                )
+                .order_by(AssetPartitionDagRun.id.desc())
+                .limit(1)
+            )
+            if latest_apdr is not None and latest_apdr.created_dag_run_id is 
not None and asset_id is None:

Review Comment:
   It can't be from the real caller, _queue_partitioned_dags always passes it. 
The None default was only there so I didn't have to touch the existing tests, 
which made the ValueError dead code. I merged refire_policy and asset_id into 
one optional superseded_key_log=(asset_id, source_partition_key) that only gets 
passed when a refire_policy is set, so the guard is gone.



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