original_docstring: Visualizes the data of a given PCollection. Optionally enables dynamic
    plotting with interval in seconds if the PCollection is being produced by a
    running pipeline or the pipeline is streaming indefinitely. The function
    always returns immediately and is asynchronous when dynamic plotting is on.
  
    If dynamic plotting enabled, the visualization is updated continuously until
    the pipeline producing the PCollection is in an end state. The visualization
    would be anchored to the notebook cell output area. The function
    asynchronously returns a handle to the visualization job immediately. The user
    could manually do::
  
      # In one notebook cell, enable dynamic plotting every 1 second:
      handle = visualize(pcoll, dynamic_plotting_interval=1)
      # Visualization anchored to the cell's output area.
      # In a different cell:
      handle.stop()
      # Will stop the dynamic plotting of the above visualization manually.
      # Otherwise, dynamic plotting ends when pipeline is not running anymore.
  
    If dynamic_plotting is not enabled (by default), None is returned.
  
    If include_window_info is True, the data will include window information,
    which consists of the event timestamps, windows, and pane info.
  
    If display_facets is True, the facets widgets will be rendered. Otherwise, the
    facets widgets will not be rendered.
  
    The function is experimental. For internal use only; no
    backwards-compatibility guarantees.
    
docstring: Visualizes the data of a given PCollection. Optionally enables dynamic
  plotting with interval in seconds if the PCollection is being produced by a
  running pipeline or the pipeline is streaming indefinitely. The function
  always returns immediately and is asynchronous when dynamic plotting is on.
  
  If dynamic plotting enabled, the visualization is updated continuously until
  the pipeline producing the PCollection is in an end state. The visualization
  would be anchored to the notebook cell output area. The function
  asynchronously returns a handle to the visualization job immediately. The user
  could manually do:.
  
  In one notebook cell, enable dynamic plotting every 1 second:
  handle = visualize(pcoll, dynamic_plotting_interval=1)
  Visualization anchored to the cell's output area.
  In a different cell:
  handle.stop()
  Will stop the dynamic plotting of the above visualization manually.
  Otherwise, dynamic plotting ends when pipeline is not running anymore.
  
  If dynamic_plotting is not enabled (by default), None is returned.
  
  If include_window_info is True, the data will include window information,
  which consists of the event timestamps, windows, and pane info.
  
  If display_facets is True, the facets widgets will be rendered. Otherwise, the
  facets widgets will not be rendered.
  
  The function is experimental. For internal use only; no
  backwards-compatibility guarantees.
docstring_tokens: Visualizes the data of a given PCollection . Optionally enables dynamic plotting with interval in seconds if the PCollection is being produced by a running pipeline or the pipeline is streaming indefinitely . The function always returns immediately and is asynchronous when dynamic plotting is on . If dynamic plotting enabled the visualization is updated continuously until the pipeline producing the PCollection is in an end state . The visualization would be anchored to the notebook cell output area . The function asynchronously returns a handle to the visualization job immediately . The user could manually do : . In one notebook cell enable dynamic plotting every 1 second : handle = visualize ( pcoll dynamic_plotting_interval = 1 ) Visualization anchored to the cell ' s output area . In a different cell : handle . stop () Will stop the dynamic plotting of the above visualization manually . Otherwise dynamic plotting ends when pipeline is not running anymore . If dynamic_plotting is not enabled ( by default ) None is returned . If include_window_info is True the data will include window information which consists of the event timestamps windows and pane info . If display_facets is True the facets widgets will be rendered . Otherwise the facets widgets will not be rendered . The function is experimental . For internal use only ; no backwards - compatibility guarantees .
code: def visualize(
      pcoll,
      dynamic_plotting_interval=None,
      include_window_info=False,
      display_facets=False):
    """Visualizes the data of a given PCollection. Optionally enables dynamic
    plotting with interval in seconds if the PCollection is being produced by a
    running pipeline or the pipeline is streaming indefinitely. The function
    always returns immediately and is asynchronous when dynamic plotting is on.
  
    If dynamic plotting enabled, the visualization is updated continuously until
    the pipeline producing the PCollection is in an end state. The visualization
    would be anchored to the notebook cell output area. The function
    asynchronously returns a handle to the visualization job immediately. The user
    could manually do::
  
      # In one notebook cell, enable dynamic plotting every 1 second:
      handle = visualize(pcoll, dynamic_plotting_interval=1)
      # Visualization anchored to the cell's output area.
      # In a different cell:
      handle.stop()
      # Will stop the dynamic plotting of the above visualization manually.
      # Otherwise, dynamic plotting ends when pipeline is not running anymore.
  
    If dynamic_plotting is not enabled (by default), None is returned.
  
    If include_window_info is True, the data will include window information,
    which consists of the event timestamps, windows, and pane info.
  
    If display_facets is True, the facets widgets will be rendered. Otherwise, the
    facets widgets will not be rendered.
  
    The function is experimental. For internal use only; no
    backwards-compatibility guarantees.
    """
    if not _pcoll_visualization_ready:
      return None
    pv = PCollectionVisualization(
        pcoll,
        include_window_info=include_window_info,
        display_facets=display_facets)
    if ie.current_env().is_in_notebook:
      pv.display()
    else:
      pv.display_plain_text()
      # We don't want to do dynamic plotting if there is no notebook frontend.
      return None
  
    if dynamic_plotting_interval:
      # Disables the verbose logging from timeloop.
      logging.getLogger('timeloop').disabled = True
      tl = Timeloop()
  
      def dynamic_plotting(pcoll, pv, tl, include_window_info, display_facets):
        @tl.job(interval=timedelta(seconds=dynamic_plotting_interval))
        def continuous_update_display():  # pylint: disable=unused-variable
          # Always creates a new PCollVisualization instance when the
          # PCollection materialization is being updated and dynamic
          # plotting is in-process.
          # PCollectionVisualization created at this level doesn't need dynamic
          # plotting interval information when instantiated because it's already
          # in dynamic plotting logic.
          updated_pv = PCollectionVisualization(
              pcoll,
              include_window_info=include_window_info,
              display_facets=display_facets)
          updated_pv.display(updating_pv=pv)
          if ie.current_env().is_terminated(pcoll.pipeline):
            try:
              tl.stop()
            except RuntimeError:
              # The job can only be stopped once. Ignore excessive stops.
              pass
  
        tl.start()
        return tl
  
      return dynamic_plotting(pcoll, pv, tl, include_window_info, display_facets)
    return None
code_tokens: def visualize ( pcoll , dynamic_plotting_interval = None , include_window_info = False , display_facets = False ) : if not _pcoll_visualization_ready : return None pv = PCollectionVisualization ( pcoll , include_window_info = include_window_info , display_facets = display_facets ) if ie . current_env ( ) . is_in_notebook : pv . display ( ) else : pv . display_plain_text ( ) return None if dynamic_plotting_interval : logging . getLogger ( 'timeloop' ) . disabled = True tl = Timeloop ( ) def dynamic_plotting ( pcoll , pv , tl , include_window_info , display_facets ) : @ tl . job ( interval = timedelta ( seconds = dynamic_plotting_interval ) ) def continuous_update_display ( ) : updated_pv = PCollectionVisualization ( pcoll , include_window_info = include_window_info , display_facets = display_facets ) updated_pv . display ( updating_pv = pv ) if ie . current_env ( ) . is_terminated ( pcoll . pipeline ) : try : tl . stop ( ) except RuntimeError : pass tl . start ( ) return tl return dynamic_plotting ( pcoll , pv , tl , include_window_info , display_facets ) return None
short_docstring: Visualizes the data of a given PCollection.
short_docstring_tokens: Visualizes the data of a given PCollection .
comment: """Visualizes the data of a given PCollection. Optionally enables dynamic
    plotting with interval in seconds if the PCollection is being produced by a
    running pipeline or the pipeline is streaming indefinitely. The function
    always returns immediately and is asynchronous when dynamic plotting is on.
  
    If dynamic plotting enabled, the visualization is updated continuously until
    the pipeline producing the PCollection is in an end state. The visualization
    would be anchored to the notebook cell output area. The function
    asynchronously returns a handle to the visualization job immediately. The user
    could manually do::
  
      # In one notebook cell, enable dynamic plotting every 1 second:
      handle = visualize(pcoll, dynamic_plotting_interval=1)
      # Visualization anchored to the cell's output area.
      # In a different cell:
      handle.stop()
      # Will stop the dynamic plotting of the above visualization manually.
      # Otherwise, dynamic plotting ends when pipeline is not running anymore.
  
    If dynamic_plotting is not enabled (by default), None is returned.
  
    If include_window_info is True, the data will include window information,
    which consists of the event timestamps, windows, and pane info.
  
    If display_facets is True, the facets widgets will be rendered. Otherwise, the
    facets widgets will not be rendered.
  
    The function is experimental. For internal use only; no
    backwards-compatibility guarantees.
    """$SEP$# We don't want to do dynamic plotting if there is no notebook frontend.$SEP$# Disables the verbose logging from timeloop.$SEP$# pylint: disable=unused-variable$SEP$# Always creates a new PCollVisualization instance when the$SEP$# PCollection materialization is being updated and dynamic$SEP$# plotting is in-process.$SEP$# PCollectionVisualization created at this level doesn't need dynamic$SEP$# plotting interval information when instantiated because it's already$SEP$# in dynamic plotting logic.$SEP$# The job can only be stopped once. Ignore excessive stops.