ashb commented on code in PR #46032:
URL: https://github.com/apache/airflow/pull/46032#discussion_r1944254835


##########
task_sdk/src/airflow/sdk/api/client.py:
##########
@@ -253,14 +253,25 @@ class XComOperations:
     def __init__(self, client: Client):
         self.client = client
 
+    def head(self, dag_id: str, run_id: str, task_id: str, key: str) -> int:
+        """Get the number of mapped XCom values."""
+        resp = self.client.head(f"xcoms/{dag_id}/{run_id}/{task_id}/{key}")
+
+        # content_range: str | None
+        if not (content_range := resp.headers["Content-Range"]) or not 
content_range.startswith(
+            "map_indexes "
+        ):
+            raise RuntimeError(f"Unable to parse Content-Range header from 
HEAD {resp.request.url}")
+        return int(content_range[len("map_indexes ") :], base=10)

Review Comment:
   Oh I thought if you didn't specify it it guessed the base. But that's JS I 
guess, so no



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