blob: 5e309dd504c4e09c98282f20310e95c83c14f2b3 [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.testing.test_stream 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 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.testing.test_stream_service module" href="apache_beam.testing.test_stream_service.html" />
<link rel="prev" title="apache_beam.testing.test_pipeline module" href="apache_beam.testing.test_pipeline.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.internal.html">apache_beam.internal 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"><a class="reference internal" href="apache_beam.runners.html">apache_beam.runners package</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="apache_beam.testing.html">apache_beam.testing package</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="apache_beam.testing.html#subpackages">Subpackages</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="apache_beam.testing.html#submodules">Submodules</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="apache_beam.testing.datatype_inference.html">apache_beam.testing.datatype_inference module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.testing.extra_assertions.html">apache_beam.testing.extra_assertions module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.testing.metric_result_matchers.html">apache_beam.testing.metric_result_matchers module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.testing.pipeline_verifiers.html">apache_beam.testing.pipeline_verifiers module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.testing.synthetic_pipeline.html">apache_beam.testing.synthetic_pipeline module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.testing.test_pipeline.html">apache_beam.testing.test_pipeline module</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">apache_beam.testing.test_stream module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.testing.test_stream_service.html">apache_beam.testing.test_stream_service module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.testing.test_utils.html">apache_beam.testing.test_utils module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.testing.util.html">apache_beam.testing.util module</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.tools.html">apache_beam.tools package</a></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>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.version.html">apache_beam.version 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.testing.html">apache_beam.testing package</a> &raquo;</li>
<li>apache_beam.testing.test_stream module</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/apache_beam.testing.test_stream.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.testing.test_stream">
<span id="apache-beam-testing-test-stream-module"></span><h1>apache_beam.testing.test_stream module<a class="headerlink" href="#module-apache_beam.testing.test_stream" title="Permalink to this headline"></a></h1>
<p>Provides TestStream for verifying streaming runner semantics.</p>
<p>For internal use only; no backwards-compatibility guarantees.</p>
<dl class="class">
<dt id="apache_beam.testing.test_stream.Event">
<em class="property">class </em><code class="descclassname">apache_beam.testing.test_stream.</code><code class="descname">Event</code><a class="reference internal" href="_modules/apache_beam/testing/test_stream.html#Event"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.testing.test_stream.Event" 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.8)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>Test stream event to be emitted during execution of a TestStream.</p>
<dl class="method">
<dt id="apache_beam.testing.test_stream.Event.to_runner_api">
<code class="descname">to_runner_api</code><span class="sig-paren">(</span><em>element_coder</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/testing/test_stream.html#Event.to_runner_api"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.testing.test_stream.Event.to_runner_api" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="staticmethod">
<dt id="apache_beam.testing.test_stream.Event.from_runner_api">
<em class="property">static </em><code class="descname">from_runner_api</code><span class="sig-paren">(</span><em>proto</em>, <em>element_coder</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/testing/test_stream.html#Event.from_runner_api"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.testing.test_stream.Event.from_runner_api" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="apache_beam.testing.test_stream.ElementEvent">
<em class="property">class </em><code class="descclassname">apache_beam.testing.test_stream.</code><code class="descname">ElementEvent</code><span class="sig-paren">(</span><em>timestamped_values</em>, <em>tag=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/testing/test_stream.html#ElementEvent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.testing.test_stream.ElementEvent" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#apache_beam.testing.test_stream.Event" title="apache_beam.testing.test_stream.Event"><code class="xref py py-class docutils literal notranslate"><span class="pre">apache_beam.testing.test_stream.Event</span></code></a></p>
<p>Element-producing test stream event.</p>
<dl class="method">
<dt id="apache_beam.testing.test_stream.ElementEvent.to_runner_api">
<code class="descname">to_runner_api</code><span class="sig-paren">(</span><em>element_coder</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/testing/test_stream.html#ElementEvent.to_runner_api"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.testing.test_stream.ElementEvent.to_runner_api" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="apache_beam.testing.test_stream.WatermarkEvent">
<em class="property">class </em><code class="descclassname">apache_beam.testing.test_stream.</code><code class="descname">WatermarkEvent</code><span class="sig-paren">(</span><em>new_watermark</em>, <em>tag=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/testing/test_stream.html#WatermarkEvent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.testing.test_stream.WatermarkEvent" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#apache_beam.testing.test_stream.Event" title="apache_beam.testing.test_stream.Event"><code class="xref py py-class docutils literal notranslate"><span class="pre">apache_beam.testing.test_stream.Event</span></code></a></p>
<p>Watermark-advancing test stream event.</p>
<dl class="method">
<dt id="apache_beam.testing.test_stream.WatermarkEvent.to_runner_api">
<code class="descname">to_runner_api</code><span class="sig-paren">(</span><em>unused_element_coder</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/testing/test_stream.html#WatermarkEvent.to_runner_api"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.testing.test_stream.WatermarkEvent.to_runner_api" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="apache_beam.testing.test_stream.ProcessingTimeEvent">
<em class="property">class </em><code class="descclassname">apache_beam.testing.test_stream.</code><code class="descname">ProcessingTimeEvent</code><span class="sig-paren">(</span><em>advance_by</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/testing/test_stream.html#ProcessingTimeEvent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.testing.test_stream.ProcessingTimeEvent" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#apache_beam.testing.test_stream.Event" title="apache_beam.testing.test_stream.Event"><code class="xref py py-class docutils literal notranslate"><span class="pre">apache_beam.testing.test_stream.Event</span></code></a></p>
<p>Processing time-advancing test stream event.</p>
<dl class="method">
<dt id="apache_beam.testing.test_stream.ProcessingTimeEvent.to_runner_api">
<code class="descname">to_runner_api</code><span class="sig-paren">(</span><em>unused_element_coder</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/testing/test_stream.html#ProcessingTimeEvent.to_runner_api"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.testing.test_stream.ProcessingTimeEvent.to_runner_api" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="class">
<dt id="apache_beam.testing.test_stream.TestStream">
<em class="property">class </em><code class="descclassname">apache_beam.testing.test_stream.</code><code class="descname">TestStream</code><span class="sig-paren">(</span><em>coder=FastPrimitivesCoder</em>, <em>events=None</em>, <em>output_tags=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/testing/test_stream.html#TestStream"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.testing.test_stream.TestStream" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="apache_beam.transforms.ptransform.html#apache_beam.transforms.ptransform.PTransform" title="apache_beam.transforms.ptransform.PTransform"><code class="xref py py-class docutils literal notranslate"><span class="pre">apache_beam.transforms.ptransform.PTransform</span></code></a></p>
<p>Test stream that generates events on an unbounded PCollection of elements.</p>
<p>Each event emits elements, advances the watermark or advances the processing
time. After all of the specified elements are emitted, ceases to produce
output.</p>
<p>To use the multi-output functionality pelase use the
‘passthrough_pcollection_output_ids’ flag. See BEAM-9322 for more info.</p>
<p>To add flag:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">apache_beam.options.pipeline_options</span> <span class="kn">import</span> <span class="n">DebugOptions</span>
<span class="n">options</span> <span class="o">=</span> <span class="o">...</span>
<span class="n">options</span><span class="o">.</span><span class="n">view_as</span><span class="p">(</span><span class="n">DebugOptions</span><span class="p">)</span><span class="o">.</span><span class="n">add_experiment</span><span class="p">(</span>
<span class="s1">&#39;passthrough_pcollection_output_ids&#39;</span><span class="p">)</span>
</pre></div>
</div>
<dl class="method">
<dt id="apache_beam.testing.test_stream.TestStream.get_windowing">
<code class="descname">get_windowing</code><span class="sig-paren">(</span><em>unused_inputs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/testing/test_stream.html#TestStream.get_windowing"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.testing.test_stream.TestStream.get_windowing" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="apache_beam.testing.test_stream.TestStream.expand">
<code class="descname">expand</code><span class="sig-paren">(</span><em>pbegin</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/testing/test_stream.html#TestStream.expand"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.testing.test_stream.TestStream.expand" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="apache_beam.testing.test_stream.TestStream.add_elements">
<code class="descname">add_elements</code><span class="sig-paren">(</span><em>elements</em>, <em>tag=None</em>, <em>event_timestamp=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/testing/test_stream.html#TestStream.add_elements"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.testing.test_stream.TestStream.add_elements" title="Permalink to this definition"></a></dt>
<dd><p>Add elements to the TestStream.</p>
<p>Elements added to the TestStream will be produced during pipeline execution.
These elements can be TimestampedValue, WindowedValue or raw unwrapped
elements that are serializable using the TestStream’s specified Coder. When
a TimestampedValue or a WindowedValue element is used, the timestamp of the
TimestampedValue or WindowedValue will be the timestamp of the produced
element; otherwise, the current watermark timestamp will be used for that
element. The windows of a given WindowedValue are ignored by the
TestStream.</p>
</dd></dl>
<dl class="method">
<dt id="apache_beam.testing.test_stream.TestStream.advance_watermark_to">
<code class="descname">advance_watermark_to</code><span class="sig-paren">(</span><em>new_watermark</em>, <em>tag=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/testing/test_stream.html#TestStream.advance_watermark_to"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.testing.test_stream.TestStream.advance_watermark_to" title="Permalink to this definition"></a></dt>
<dd><p>Advance the watermark to a given Unix timestamp.</p>
<p>The Unix timestamp value used must be later than the previous watermark
value and should be given as an int, float or utils.timestamp.Timestamp
object.</p>
</dd></dl>
<dl class="method">
<dt id="apache_beam.testing.test_stream.TestStream.advance_watermark_to_infinity">
<code class="descname">advance_watermark_to_infinity</code><span class="sig-paren">(</span><em>tag=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/testing/test_stream.html#TestStream.advance_watermark_to_infinity"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.testing.test_stream.TestStream.advance_watermark_to_infinity" title="Permalink to this definition"></a></dt>
<dd><p>Advance the watermark to the end of time, completing this TestStream.</p>
</dd></dl>
<dl class="method">
<dt id="apache_beam.testing.test_stream.TestStream.advance_processing_time">
<code class="descname">advance_processing_time</code><span class="sig-paren">(</span><em>advance_by</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/testing/test_stream.html#TestStream.advance_processing_time"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.testing.test_stream.TestStream.advance_processing_time" title="Permalink to this definition"></a></dt>
<dd><p>Advance the current processing time by a given duration in seconds.</p>
<p>The duration must be a positive second duration and should be given as an
int, float or utils.timestamp.Duration object.</p>
</dd></dl>
<dl class="method">
<dt id="apache_beam.testing.test_stream.TestStream.to_runner_api_parameter">
<code class="descname">to_runner_api_parameter</code><span class="sig-paren">(</span><em>context</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/testing/test_stream.html#TestStream.to_runner_api_parameter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.testing.test_stream.TestStream.to_runner_api_parameter" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="staticmethod">
<dt id="apache_beam.testing.test_stream.TestStream.from_runner_api_parameter">
<em class="property">static </em><code class="descname">from_runner_api_parameter</code><span class="sig-paren">(</span><em>ptransform</em>, <em>payload</em>, <em>context</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/testing/test_stream.html#TestStream.from_runner_api_parameter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.testing.test_stream.TestStream.from_runner_api_parameter" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="apache_beam.testing.test_stream_service.html" class="btn btn-neutral float-right" title="apache_beam.testing.test_stream_service module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="apache_beam.testing.test_pipeline.html" class="btn btn-neutral float-left" title="apache_beam.testing.test_pipeline 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>