jason810496 commented on code in PR #68232:
URL: https://github.com/apache/airflow/pull/68232#discussion_r3410790225
##########
airflow-core/src/airflow/api_fastapi/execution_api/routes/task_store.py:
##########
@@ -58,15 +58,20 @@ def _get_task_scope_for_ti(task_instance_id: UUID, session:
Session) -> TaskScop
return TaskScope(dag_id=ti.dag_id, run_id=ti.run_id, task_id=ti.task_id,
map_index=ti.map_index)
Review Comment:
IIUC, we don't need to change the exiting "sync" route to "async" route
definition at all to support the feature. I will prefer to keep the routes
as-is.
##########
task-sdk/src/airflow/sdk/execution_time/context.py:
##########
@@ -535,10 +536,22 @@ def get(self, key: str, default: JsonValue = None) ->
JsonValue:
``datetime`` is not JSON-serializable; store it as
``value.isoformat()`` and
parse it back with ``datetime.fromisoformat(result)``.
"""
- from airflow.sdk.execution_time.comms import ErrorResponse,
GetTaskStore, TaskStoreResult
+ from airflow.sdk.execution_time.comms import GetTaskStore
from airflow.sdk.execution_time.task_runner import SUPERVISOR_COMMS
resp = SUPERVISOR_COMMS.send(GetTaskStore(ti_id=self._ti_id, key=key))
+ return self._extract_get_response(resp, key, default)
+
+ async def aget(self, key: str, default: JsonValue = None) -> JsonValue:
Review Comment:
Yes, changing `task-sdk/src/airflow/sdk/execution_time/context.py` would be
sufficient.
##########
airflow-core/docs/core-concepts/task-store.rst:
##########
@@ -139,6 +141,18 @@ For :doc:`mapped tasks
</authoring-and-scheduling/dynamic-task-mapping>`, the de
# clear all map indices (fleet-wide)
task_store.clear(all_map_indices=True)
+``aget(key, default)`` and ``aset(key, value, *, retention=None)``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Review Comment:
```suggestion
``aget(key, default)`` and ``aset(key, value, *, retention=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]