KevinGG commented on a change in pull request #14368:
URL: https://github.com/apache/beam/pull/14368#discussion_r605239611



##########
File path: sdks/python/apache_beam/runners/interactive/caching/read_cache.py
##########
@@ -0,0 +1,131 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+"""Module to read cache of computed PCollections.
+
+For internal use only; no backward-compatibility guarantees.
+"""
+# pytype: skip-file
+
+from __future__ import absolute_import
+
+from typing import Tuple
+
+import apache_beam as beam
+from apache_beam.portability.api import beam_runner_api_pb2
+from apache_beam.runners.interactive import cache_manager as cache
+from apache_beam.runners.interactive.caching.cacheable import Cacheable
+from apache_beam.runners.pipeline_context import PipelineContext
+from apache_beam.transforms.ptransform import PTransform
+
+
+class ReadCache:
+  """Class that facilitates reading cache of computed PCollections.
+  """
+  def __init__(
+      self,
+      pipeline: beam_runner_api_pb2.Pipeline,
+      context: PipelineContext,
+      cache_manager: cache.CacheManager,
+      cacheable: Cacheable):
+    self._pipeline = pipeline
+    self._context = context
+    self._cache_manager = cache_manager
+    self._cacheable = cacheable
+    self._key = repr(cacheable.to_key())
+    self._label = '{}{}'.format('_cache_', self._key)
+
+  def read_cache(self) -> Tuple[str, str]:

Review comment:
       I'll add more comments.




-- 
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:
[email protected]


Reply via email to