You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/08/19 23:26:12 UTC

[GitHub] [beam] KevinGG commented on a change in pull request #12415: [BEAM-10603] Add the RecordingManager and associated classes.

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



##########
File path: sdks/python/apache_beam/runners/interactive/recording_manager.py
##########
@@ -0,0 +1,334 @@
+#
+# 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.
+#
+
+from __future__ import absolute_import
+
+import logging
+import threading
+import time
+import warnings
+
+import apache_beam as beam
+from apache_beam.runners.interactive import background_caching_job as bcj
+from apache_beam.runners.interactive import interactive_environment as ie
+from apache_beam.runners.interactive import interactive_runner as ir
+from apache_beam.runners.interactive import pipeline_fragment as pf
+from apache_beam.runners.interactive import pipeline_instrument as pi
+from apache_beam.runners.interactive import utils
+from apache_beam.runners.interactive.options.capture_limiters import CountLimiter
+from apache_beam.runners.interactive.options.capture_limiters import ProcessingTimeLimiter
+
+_LOGGER = logging.getLogger(__name__)
+
+PipelineState = beam.runners.runner.PipelineState
+
+
+class ElementStream:
+  """A stream of elements from a given PCollection."""
+  def __init__(
+      self,
+      pcoll,  # type: beam.pvalue.PCollection
+      var,  # type: str
+      cache_key,  # type: str
+      max_n,  # type: int
+      max_duration_secs  # type: float
+      ):
+    self._pcoll = pcoll
+    self._cache_key = cache_key
+    self._pipeline = pcoll.pipeline
+    self._var = var
+    self._n = max_n
+    self._duration_secs = max_duration_secs
+
+    # A small state variable that when True, indicates that no more new elements
+    # will be yielded if read() is called again.
+    self._done = False
+
+  def var(self):
+    # type: () -> str
+
+    """Returns the variable named that defined this PCollection."""
+    return self._var
+
+  def display_id(self, suffix):
+    #Any type: (str) -> str

Review comment:
       Is the `Any` some special type hint or a typo?




----------------------------------------------------------------
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:
users@infra.apache.org