amoghrajesh commented on code in PR #44605:
URL: https://github.com/apache/airflow/pull/44605#discussion_r1870819682
##########
task_sdk/src/airflow/sdk/api/client.py:
##########
@@ -169,6 +169,19 @@ def get(self, dag_id: str, run_id: str, task_id: str, key:
str, map_index: int =
resp = self.client.get(f"xcoms/{dag_id}/{run_id}/{task_id}/{key}",
params={"map_index": map_index})
return XComResponse.model_validate_json(resp.read())
+ def set(
+ self, dag_id: str, run_id: str, task_id: str, key: str, value,
map_index: int | None = None
+ ) -> dict[str, bool]:
+ """Set a XCom value via the API server."""
+ params = {}
+ if map_index:
+ params = {"map_index": map_index}
+ self.client.post(f"xcoms/{dag_id}/{run_id}/{task_id}/{key}",
params=params, json=value)
Review Comment:
Should I leave a comment on this one and we can check again later?
##########
task_sdk/src/airflow/sdk/api/client.py:
##########
@@ -169,6 +169,19 @@ def get(self, dag_id: str, run_id: str, task_id: str, key:
str, map_index: int =
resp = self.client.get(f"xcoms/{dag_id}/{run_id}/{task_id}/{key}",
params={"map_index": map_index})
return XComResponse.model_validate_json(resp.read())
+ def set(
+ self, dag_id: str, run_id: str, task_id: str, key: str, value,
map_index: int | None = None
+ ) -> dict[str, bool]:
+ """Set a XCom value via the API server."""
+ params = {}
+ if map_index:
+ params = {"map_index": map_index}
+ self.client.post(f"xcoms/{dag_id}/{run_id}/{task_id}/{key}",
params=params, json=value)
Review Comment:
I just added a TODO in the code for this part, we can revisit it always once
we start testing things
--
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]