henry3260 opened a new pull request, #73119:
URL: https://github.com/apache/airflow/pull/73119
The `DELETE` queued events endpoints only cleared queued events of
non-partitioned assets (`AssetDagRunQueue`). A queued partitioned event
(`AssetPartitionDagRun` + `PartitionedAssetKeyLog`) that turned out to be wrong
or no longer relevant could not be removed, so it would still trigger the
downstream Dag run.
This adds an optional `partition_key` query parameter to:
- `DELETE /api/v2/assets/{asset_id}/queuedEvents`
- `DELETE /api/v2/dags/{dag_id}/assets/queuedEvents`
- `DELETE /api/v2/dags/{dag_id}/assets/{asset_id}/queuedEvents`
Behaviour when `partition_key` is given:
- `partition_key` matches the partition key of the Dag run the events would
create (`AssetPartitionDagRun.partition_key`), the same meaning as
`partition_key` in `POST /assets/{asset_id}/materialize`. It can differ from
the upstream event's key when the Dag uses a partition mapper.
- Only pending partitions (`created_dag_run_id IS NULL`) are touched;
partitions that already created a Dag run are kept.
- Queued events of non-partitioned assets (`AssetDagRunQueue`) are not
deleted.
- The `asset_id`, `before`, and readable-Dag filters apply to the
contributing `PartitionedAssetKeyLog` rows. A pending `AssetPartitionDagRun` is
deleted only once none of its contributing rows remain, so clearing one asset
of a multi-asset partition keeps the partition waiting for that asset instead
of dropping the other assets' progress. An empty pending partition would
otherwise sit at the head of the scheduler's FIFO queue forever.
- Returns 404 when nothing was deleted, as before.
Without `partition_key` the endpoints behave exactly as before.
closes: #70444
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes — Claude Opus 5
Generated-by: Claude Opus 5 following [the
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_018EGULdqFLqrhfydnQik9Fv
--
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]