lukecwik commented on code in PR #23046:
URL: https://github.com/apache/beam/pull/23046#discussion_r966397992
##########
sdks/python/apache_beam/runners/worker/sdk_worker.py:
##########
@@ -1149,22 +1149,9 @@ def blocking_get(
return self._lazy_iterator(state_key, coder)
# Cache lookup
cache_state_key = self._convert_to_cache_key(state_key)
- cached_value = self._state_cache.get(cache_state_key, cache_token)
- if cached_value is None:
- # Cache miss, need to retrieve from the Runner
- # Further size estimation or the use of the continuation token on the
- # runner side could fall back to materializing one item at a time.
- # https://jira.apache.org/jira/browse/BEAM-8297
- materialized = cached_value = (
- self._partially_cached_iterable(state_key, coder))
- if isinstance(materialized, (list, self.ContinuationIterable)):
- self._state_cache.put(cache_state_key, cache_token, materialized)
- else:
- _LOGGER.error(
- "Uncacheable type %s for key %s. Not caching.",
- materialized,
- state_key)
- return cached_value
+ return self._state_cache.get(
+ (cache_state_key, cache_token),
Review Comment:
The cache token is referring to this
[token](https://github.com/apache/beam/blob/f0cd27596e3a59d6ee013ee2db232d24f46ad70a/model/fn-execution/src/main/proto/org/apache/beam/model/fn_execution/v1/beam_fn_api.proto#L297)
that represents all user state. We still need to create a cache key that is
scoped to the specific user state (e.g. which ptransform and what state key).
--
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]