[ 
https://issues.apache.org/jira/browse/BEAM-8298?focusedWorklogId=378690&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-378690
 ]

ASF GitHub Bot logged work on BEAM-8298:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 29/Jan/20 09:43
            Start Date: 29/Jan/20 09:43
    Worklog Time Spent: 10m 
      Work Description: mxm commented on pull request #10705: [BEAM-8298] 
Implement side input caching.
URL: https://github.com/apache/beam/pull/10705#discussion_r372277046
 
 

 ##########
 File path: sdks/python/apache_beam/runners/worker/statecache.py
 ##########
 @@ -148,47 +148,43 @@ class StateCache(object):
 
   def __init__(self, max_entries):
     _LOGGER.info('Creating state cache with size %s', max_entries)
-    self._cache = self.LRUCache(max_entries, (None, None))
+    self._missing = None
+    self._cache = self.LRUCache(max_entries, self._missing)
     self._lock = threading.RLock()
     self._metrics = Metrics()
 
   @Metrics.counter_hit_miss("get", "hit", "miss")
   def get(self, state_key, cache_token):
     assert cache_token and self.is_cache_enabled()
     with self._lock:
-      token, value = self._cache.get(state_key)
-    return value if token == cache_token else None
+      return self._cache.get((state_key, cache_token))
 
   @Metrics.counter("put")
   def put(self, state_key, cache_token, value):
     assert cache_token and self.is_cache_enabled()
     with self._lock:
-      return self._cache.put(state_key, (cache_token, value))
+      return self._cache.put((state_key, cache_token), value)
 
 Review comment:
   The combined use of `(state_key, cache_token)` simplifies the lookup. Thanks 
for fixing this.
 
----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 378690)
    Time Spent: 2h 10m  (was: 2h)

> Implement state caching for side inputs
> ---------------------------------------
>
>                 Key: BEAM-8298
>                 URL: https://issues.apache.org/jira/browse/BEAM-8298
>             Project: Beam
>          Issue Type: Improvement
>          Components: runner-core, sdk-py-harness
>            Reporter: Maximilian Michels
>            Assignee: Jing Chen
>            Priority: Major
>          Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> Caching is currently only implemented for user state.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to