blob: 0129c1cba23a205997be6d110ff92fe357a0f7f4 [file] [log] [blame]
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>apache_beam.runners.interactive.display.pcoll_visualization module &mdash; Apache Beam documentation</title>
<script type="text/javascript" src="_static/js/modernizr.min.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="apache_beam.runners.interactive.display.pipeline_graph module" href="apache_beam.runners.interactive.display.pipeline_graph.html" />
<link rel="prev" title="apache_beam.runners.interactive.display.interactive_pipeline_graph module" href="apache_beam.runners.interactive.display.interactive_pipeline_graph.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home"> Apache Beam
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="apache_beam.coders.html">apache_beam.coders package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.dataframe.html">apache_beam.dataframe package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.io.html">apache_beam.io package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.metrics.html">apache_beam.metrics package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.ml.html">apache_beam.ml package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.options.html">apache_beam.options package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.portability.html">apache_beam.portability package</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="apache_beam.runners.html">apache_beam.runners package</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="apache_beam.runners.html#subpackages">Subpackages</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="apache_beam.runners.dataflow.html">apache_beam.runners.dataflow package</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.runners.direct.html">apache_beam.runners.direct package</a></li>
<li class="toctree-l3 current"><a class="reference internal" href="apache_beam.runners.interactive.html">apache_beam.runners.interactive package</a><ul class="current">
<li class="toctree-l4 current"><a class="reference internal" href="apache_beam.runners.interactive.html#subpackages">Subpackages</a></li>
<li class="toctree-l4"><a class="reference internal" href="apache_beam.runners.interactive.html#submodules">Submodules</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.runners.job.html">apache_beam.runners.job package</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="apache_beam.runners.html#submodules">Submodules</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.transforms.html">apache_beam.transforms package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.typehints.html">apache_beam.typehints package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.utils.html">apache_beam.utils package</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.error.html">apache_beam.error module</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.pipeline.html">apache_beam.pipeline module</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.pvalue.html">apache_beam.pvalue module</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Apache Beam</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> &raquo;</li>
<li><a href="apache_beam.runners.html">apache_beam.runners package</a> &raquo;</li>
<li><a href="apache_beam.runners.interactive.html">apache_beam.runners.interactive package</a> &raquo;</li>
<li><a href="apache_beam.runners.interactive.display.html">apache_beam.runners.interactive.display package</a> &raquo;</li>
<li>apache_beam.runners.interactive.display.pcoll_visualization module</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/apache_beam.runners.interactive.display.pcoll_visualization.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="module-apache_beam.runners.interactive.display.pcoll_visualization">
<span id="apache-beam-runners-interactive-display-pcoll-visualization-module"></span><h1>apache_beam.runners.interactive.display.pcoll_visualization module<a class="headerlink" href="#module-apache_beam.runners.interactive.display.pcoll_visualization" title="Permalink to this headline"></a></h1>
<p>Module visualizes PCollection data.</p>
<p>For internal use only; no backwards-compatibility guarantees.
Only works with Python 3.5+.</p>
<dl class="function">
<dt id="apache_beam.runners.interactive.display.pcoll_visualization.visualize">
<code class="descclassname">apache_beam.runners.interactive.display.pcoll_visualization.</code><code class="descname">visualize</code><span class="sig-paren">(</span><em>stream</em>, <em>dynamic_plotting_interval=None</em>, <em>include_window_info=False</em>, <em>display_facets=False</em>, <em>element_type=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/runners/interactive/display/pcoll_visualization.html#visualize"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.runners.interactive.display.pcoll_visualization.visualize" title="Permalink to this definition"></a></dt>
<dd><p>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.</p>
<p>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:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># In one notebook cell, enable dynamic plotting every 1 second:</span>
<span class="n">handle</span> <span class="o">=</span> <span class="n">visualize</span><span class="p">(</span><span class="n">pcoll</span><span class="p">,</span> <span class="n">dynamic_plotting_interval</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span>
<span class="c1"># Visualization anchored to the cell&#39;s output area.</span>
<span class="c1"># In a different cell:</span>
<span class="n">handle</span><span class="o">.</span><span class="n">stop</span><span class="p">()</span>
<span class="c1"># Will stop the dynamic plotting of the above visualization manually.</span>
<span class="c1"># Otherwise, dynamic plotting ends when pipeline is not running anymore.</span>
</pre></div>
</div>
<p>If dynamic_plotting is not enabled (by default), None is returned.</p>
<p>If include_window_info is True, the data will include window information,
which consists of the event timestamps, windows, and pane info.</p>
<p>If display_facets is True, the facets widgets will be rendered. Otherwise, the
facets widgets will not be rendered.</p>
<p>The function is experimental. For internal use only; no
backwards-compatibility guarantees.</p>
</dd></dl>
<dl class="function">
<dt id="apache_beam.runners.interactive.display.pcoll_visualization.visualize_computed_pcoll">
<code class="descclassname">apache_beam.runners.interactive.display.pcoll_visualization.</code><code class="descname">visualize_computed_pcoll</code><span class="sig-paren">(</span><em>pcoll_name: str</em>, <em>pcoll: apache_beam.pvalue.PCollection</em>, <em>max_n: int</em>, <em>max_duration_secs: float</em>, <em>dynamic_plotting_interval: Optional[int] = None</em>, <em>include_window_info: bool = False</em>, <em>display_facets: bool = False</em><span class="sig-paren">)</span> &#x2192; None<a class="reference internal" href="_modules/apache_beam/runners/interactive/display/pcoll_visualization.html#visualize_computed_pcoll"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.runners.interactive.display.pcoll_visualization.visualize_computed_pcoll" title="Permalink to this definition"></a></dt>
<dd><p>A simple visualize alternative.</p>
<p>When the pcoll_name and pcoll pair identifies a watched and computed
PCollection in the current interactive environment without ambiguity, an
ElementStream can be built directly from cache. Returns immediately, the
visualization is asynchronous, but guaranteed to end in the near future.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>pcoll_name</strong> – the variable name of the PCollection.</li>
<li><strong>pcoll</strong> – the PCollection to be visualized.</li>
<li><strong>max_n</strong> – the maximum number of elements to visualize.</li>
<li><strong>max_duration_secs</strong> – max duration of elements to read in seconds.</li>
<li><strong>dynamic_plotting_interval</strong> – the interval in seconds between visualization
updates if provided; otherwise, no dynamic plotting.</li>
<li><strong>include_window_info</strong> – whether to include windowing info in the elements.</li>
<li><strong>display_facets</strong> – whether to display the facets widgets.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="class">
<dt id="apache_beam.runners.interactive.display.pcoll_visualization.PCollectionVisualization">
<em class="property">class </em><code class="descclassname">apache_beam.runners.interactive.display.pcoll_visualization.</code><code class="descname">PCollectionVisualization</code><span class="sig-paren">(</span><em>stream</em>, <em>include_window_info=False</em>, <em>display_facets=False</em>, <em>element_type=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/runners/interactive/display/pcoll_visualization.html#PCollectionVisualization"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.runners.interactive.display.pcoll_visualization.PCollectionVisualization" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.10)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>A visualization of a PCollection.</p>
<p>The class relies on creating a PipelineInstrument w/o actual instrument to
access current interactive environment for materialized PCollection data at
the moment of self instantiation through cache.</p>
<dl class="method">
<dt id="apache_beam.runners.interactive.display.pcoll_visualization.PCollectionVisualization.display_plain_text">
<code class="descname">display_plain_text</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/runners/interactive/display/pcoll_visualization.html#PCollectionVisualization.display_plain_text"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.runners.interactive.display.pcoll_visualization.PCollectionVisualization.display_plain_text" title="Permalink to this definition"></a></dt>
<dd><p>Displays a head sample of the normalized PCollection data.</p>
<p>This function is used when the ipython kernel is not connected to a
notebook frontend such as when running ipython in terminal or in unit tests.
It’s a visualization in terminal-like UI, not a function to retrieve data
for programmatically usages.</p>
</dd></dl>
<dl class="method">
<dt id="apache_beam.runners.interactive.display.pcoll_visualization.PCollectionVisualization.display">
<code class="descname">display</code><span class="sig-paren">(</span><em>updating_pv=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/runners/interactive/display/pcoll_visualization.html#PCollectionVisualization.display"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.runners.interactive.display.pcoll_visualization.PCollectionVisualization.display" title="Permalink to this definition"></a></dt>
<dd><p>Displays the visualization through IPython.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>updating_pv</strong> – A PCollectionVisualization object. When provided, the
display_id of each visualization part will inherit from the initial
display of updating_pv and only update that visualization web element
instead of creating new ones.</td>
</tr>
</tbody>
</table>
<p>The visualization has 3 parts: facets-dive, facets-overview and paginated
data table. Each part is assigned an auto-generated unique display id
(the uniqueness is guaranteed throughout the lifespan of the PCollection
variable).</p>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="apache_beam.runners.interactive.display.pcoll_visualization.format_window_info_in_dataframe">
<code class="descclassname">apache_beam.runners.interactive.display.pcoll_visualization.</code><code class="descname">format_window_info_in_dataframe</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/runners/interactive/display/pcoll_visualization.html#format_window_info_in_dataframe"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.runners.interactive.display.pcoll_visualization.format_window_info_in_dataframe" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="apache_beam.runners.interactive.display.pcoll_visualization.event_time_formatter">
<code class="descclassname">apache_beam.runners.interactive.display.pcoll_visualization.</code><code class="descname">event_time_formatter</code><span class="sig-paren">(</span><em>event_time_us</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/runners/interactive/display/pcoll_visualization.html#event_time_formatter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.runners.interactive.display.pcoll_visualization.event_time_formatter" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="apache_beam.runners.interactive.display.pcoll_visualization.windows_formatter">
<code class="descclassname">apache_beam.runners.interactive.display.pcoll_visualization.</code><code class="descname">windows_formatter</code><span class="sig-paren">(</span><em>windows</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/runners/interactive/display/pcoll_visualization.html#windows_formatter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.runners.interactive.display.pcoll_visualization.windows_formatter" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="apache_beam.runners.interactive.display.pcoll_visualization.pane_info_formatter">
<code class="descclassname">apache_beam.runners.interactive.display.pcoll_visualization.</code><code class="descname">pane_info_formatter</code><span class="sig-paren">(</span><em>pane_info</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/runners/interactive/display/pcoll_visualization.html#pane_info_formatter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.runners.interactive.display.pcoll_visualization.pane_info_formatter" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="apache_beam.runners.interactive.display.pipeline_graph.html" class="btn btn-neutral float-right" title="apache_beam.runners.interactive.display.pipeline_graph module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="apache_beam.runners.interactive.display.interactive_pipeline_graph.html" class="btn btn-neutral float-left" title="apache_beam.runners.interactive.display.interactive_pipeline_graph module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>