kaxil commented on code in PR #59874:
URL: https://github.com/apache/airflow/pull/59874#discussion_r3625022082
##########
task-sdk/src/airflow/sdk/api/client.py:
##########
@@ -652,6 +653,27 @@ def delete(
# decouple from the server response string
return OKResponse(ok=True)
+ def delete_all(
+ self,
+ dag_id: str,
+ run_id: str,
+ task_id: str | None = None,
+ key: str | None = None,
+ map_index: int | None = None,
+ ) -> XComDeleteCountResult:
+ """Bulk delete XCom values via the API server."""
+ params: dict[str, str | int] = {}
+
+ if map_index is not None and map_index >= 0:
Review Comment:
`delete_all` drops `map_index` when it's `-1` (the `>= 0` guard), but the
bulk endpoint treats a missing `map_index` as "all map indexes" and only
filters when a value is sent. So `delete_all(dag_id, run_id, map_index=-1)`,
meant to target non-mapped XComs, silently deletes every map index for the run
instead. The `>= 0` guard fits `delete()` where the server defaults `map_index`
to `-1`, but here `None` is the "unspecified" sentinel, so I think this should
be `if map_index is not None:`.
--
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]