guan404ming commented on code in PR #68232:
URL: https://github.com/apache/airflow/pull/68232#discussion_r3480912854
##########
task-sdk/src/airflow/sdk/execution_time/context.py:
##########
@@ -628,6 +653,16 @@ def delete(self, key: str) -> None:
if backend is not None:
backend.delete(self._scope, key)
+ async def adelete(self, key: str) -> None:
+ """Async version of :meth:`delete` that awaits instead of blocking the
event loop."""
+ from airflow.sdk.execution_time.comms import DeleteTaskStateStore
+ from airflow.sdk.execution_time.task_runner import SUPERVISOR_COMMS
+
+ await SUPERVISOR_COMMS.asend(DeleteTaskStateStore(ti_id=self._ti_id,
key=key))
+ backend = _get_worker_state_store_backend()
+ if backend is not None:
+ backend.delete(self._scope, key)
Review Comment:
Good catch. adelete/aclear now await backend.adelete/aclear. Added
custom-backend tests asserting the async path is used. aget/aset left as-is
since the serialize/deserialize helpers have no async variant currently.
--
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]