| |
| |
| <!DOCTYPE html> |
| <html class="writer-html5" lang="en" data-content_root="./"> |
| <head> |
| <meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /> |
| |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| <title>apache_beam.io.requestresponse module — Apache Beam 2.67.0 documentation</title> |
| <link rel="stylesheet" type="text/css" href="_static/pygments.css?v=b86133f3" /> |
| <link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" /> |
| |
| |
| <script src="_static/jquery.js?v=5d32c60e"></script> |
| <script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script> |
| <script src="_static/documentation_options.js?v=959b4fbe"></script> |
| <script src="_static/doctools.js?v=9a2dae69"></script> |
| <script src="_static/sphinx_highlight.js?v=dc90522c"></script> |
| <script src="_static/js/theme.js"></script> |
| <link rel="index" title="Index" href="genindex.html" /> |
| <link rel="search" title="Search" href="search.html" /> |
| <link rel="next" title="apache_beam.io.restriction_trackers module" href="apache_beam.io.restriction_trackers.html" /> |
| <link rel="prev" title="apache_beam.io.range_trackers module" href="apache_beam.io.range_trackers.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" aria-label="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="Navigation menu"> |
| <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 current"><a class="reference internal" href="apache_beam.io.html">apache_beam.io package</a><ul class="current"> |
| <li class="toctree-l2"><a class="reference internal" href="apache_beam.io.html#subpackages">Subpackages</a></li> |
| <li class="toctree-l2 current"><a class="reference internal" href="apache_beam.io.html#submodules">Submodules</a><ul class="current"> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.avroio.html">apache_beam.io.avroio module</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.concat_source.html">apache_beam.io.concat_source module</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.debezium.html">apache_beam.io.debezium module</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.filebasedsink.html">apache_beam.io.filebasedsink module</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.filebasedsource.html">apache_beam.io.filebasedsource module</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.fileio.html">apache_beam.io.fileio module</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.filesystem.html">apache_beam.io.filesystem module</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.filesystemio.html">apache_beam.io.filesystemio module</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.filesystems.html">apache_beam.io.filesystems module</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.hadoopfilesystem.html">apache_beam.io.hadoopfilesystem module</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.iobase.html">apache_beam.io.iobase module</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.jdbc.html">apache_beam.io.jdbc module</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.kafka.html">apache_beam.io.kafka module</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.kinesis.html">apache_beam.io.kinesis module</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.localfilesystem.html">apache_beam.io.localfilesystem module</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.mongodbio.html">apache_beam.io.mongodbio module</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.parquetio.html">apache_beam.io.parquetio module</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.range_trackers.html">apache_beam.io.range_trackers module</a></li> |
| <li class="toctree-l3 current"><a class="current reference internal" href="#">apache_beam.io.requestresponse module</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="#apache_beam.io.requestresponse.RequestResponseIO"><code class="docutils literal notranslate"><span class="pre">RequestResponseIO</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#apache_beam.io.requestresponse.ExponentialBackOffRepeater"><code class="docutils literal notranslate"><span class="pre">ExponentialBackOffRepeater</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#apache_beam.io.requestresponse.DefaultThrottler"><code class="docutils literal notranslate"><span class="pre">DefaultThrottler</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#apache_beam.io.requestresponse.NoOpsRepeater"><code class="docutils literal notranslate"><span class="pre">NoOpsRepeater</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#apache_beam.io.requestresponse.RedisCache"><code class="docutils literal notranslate"><span class="pre">RedisCache</span></code></a></li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.restriction_trackers.html">apache_beam.io.restriction_trackers module</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.snowflake.html">apache_beam.io.snowflake module</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.source_test_utils.html">apache_beam.io.source_test_utils module</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.textio.html">apache_beam.io.textio module</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.tfrecordio.html">apache_beam.io.tfrecordio module</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.utils.html">apache_beam.io.utils module</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="apache_beam.io.watermark_estimators.html">apache_beam.io.watermark_estimators module</a></li> |
| </ul> |
| </li> |
| </ul> |
| </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"><a class="reference internal" href="apache_beam.testing.html">apache_beam.testing 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> |
| <li class="toctree-l1"><a class="reference internal" href="apache_beam.yaml.html">apache_beam.yaml 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="Mobile navigation menu" > |
| <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="Page navigation"> |
| <ul class="wy-breadcrumbs"> |
| <li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li> |
| <li class="breadcrumb-item"><a href="apache_beam.io.html">apache_beam.io package</a></li> |
| <li class="breadcrumb-item active">apache_beam.io.requestresponse module</li> |
| <li class="wy-breadcrumbs-aside"> |
| <a href="_sources/apache_beam.io.requestresponse.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"> |
| |
| <section id="module-apache_beam.io.requestresponse"> |
| <span id="apache-beam-io-requestresponse-module"></span><h1>apache_beam.io.requestresponse module<a class="headerlink" href="#module-apache_beam.io.requestresponse" title="Link to this heading"></a></h1> |
| <p><code class="docutils literal notranslate"><span class="pre">PTransform</span></code> for reading from and writing to Web APIs.</p> |
| <dl class="py class"> |
| <dt class="sig sig-object py" id="apache_beam.io.requestresponse.RequestResponseIO"> |
| <em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">apache_beam.io.requestresponse.</span></span><span class="sig-name descname"><span class="pre">RequestResponseIO</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="pre">caller:</span> <span class="pre">~apache_beam.io.requestresponse.Caller[~apache_beam.io.requestresponse.RequestT,</span> <span class="pre">~apache_beam.io.requestresponse.ResponseT],</span> <span class="pre">timeout:</span> <span class="pre">float</span> <span class="pre">|</span> <span class="pre">None</span> <span class="pre">=</span> <span class="pre">30,</span> <span class="pre">should_backoff:</span> <span class="pre">~apache_beam.io.requestresponse.ShouldBackOff</span> <span class="pre">|</span> <span class="pre">None</span> <span class="pre">=</span> <span class="pre">None,</span> <span class="pre">repeater:</span> <span class="pre">~apache_beam.io.requestresponse.Repeater</span> <span class="pre">=</span> <span class="pre"><apache_beam.io.requestresponse.ExponentialBackOffRepeater</span> <span class="pre">object>,</span> <span class="pre">cache:</span> <span class="pre">~apache_beam.io.requestresponse.Cache</span> <span class="pre">|</span> <span class="pre">None</span> <span class="pre">=</span> <span class="pre">None,</span> <span class="pre">throttler:</span> <span class="pre">~apache_beam.io.requestresponse.PreCallThrottler</span> <span class="pre">=</span> <span class="pre"><apache_beam.io.requestresponse.DefaultThrottler</span> <span class="pre">object></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/requestresponse.html#RequestResponseIO"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.requestresponse.RequestResponseIO" title="Link 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">PTransform</span></code></a>[<a class="reference internal" href="apache_beam.pvalue.html#apache_beam.pvalue.PCollection" title="apache_beam.pvalue.PCollection"><code class="xref py py-class docutils literal notranslate"><span class="pre">PCollection</span></code></a>[<code class="xref py py-obj docutils literal notranslate"><span class="pre">RequestT</span></code>], <a class="reference internal" href="apache_beam.pvalue.html#apache_beam.pvalue.PCollection" title="apache_beam.pvalue.PCollection"><code class="xref py py-class docutils literal notranslate"><span class="pre">PCollection</span></code></a>[<code class="xref py py-obj docutils literal notranslate"><span class="pre">ResponseT</span></code>]]</p> |
| <p>A <a class="reference internal" href="#apache_beam.io.requestresponse.RequestResponseIO" title="apache_beam.io.requestresponse.RequestResponseIO"><code class="xref py py-class docutils literal notranslate"><span class="pre">RequestResponseIO</span></code></a> transform to read and write to APIs.</p> |
| <p>Processes an input <a class="reference internal" href="apache_beam.pvalue.html#apache_beam.pvalue.PCollection" title="apache_beam.pvalue.PCollection"><code class="xref py py-class docutils literal notranslate"><span class="pre">PCollection</span></code></a> of requests |
| by making a call to the API as defined in <cite>Caller</cite>’s <cite>__call__</cite> method |
| and returns a <a class="reference internal" href="apache_beam.pvalue.html#apache_beam.pvalue.PCollection" title="apache_beam.pvalue.PCollection"><code class="xref py py-class docutils literal notranslate"><span class="pre">PCollection</span></code></a> of responses.</p> |
| <p>Instantiates a RequestResponseIO transform.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters<span class="colon">:</span></dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>caller</strong> – an implementation of |
| <cite>Caller</cite> object that makes call to the API.</p></li> |
| <li><p><strong>timeout</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.13)"><em>float</em></a>) – timeout value in seconds to wait for response from API.</p></li> |
| <li><p><strong>should_backoff</strong> – (Optional) provides methods for backoff.</p></li> |
| <li><p><strong>repeater</strong> – provides method to repeat failed requests to API due to service |
| errors. Defaults to |
| <a class="reference internal" href="#apache_beam.io.requestresponse.ExponentialBackOffRepeater" title="apache_beam.io.requestresponse.ExponentialBackOffRepeater"><code class="xref py py-class docutils literal notranslate"><span class="pre">apache_beam.io.requestresponse.ExponentialBackOffRepeater</span></code></a> to |
| repeat requests with exponential backoff.</p></li> |
| <li><p><strong>cache</strong> – (Optional) a <cite>~apache_beam.io.requestresponse.Cache</cite> object |
| to use the appropriate cache.</p></li> |
| <li><p><strong>throttler</strong> – provides methods to pre-throttle a request. Defaults to |
| <a class="reference internal" href="#apache_beam.io.requestresponse.DefaultThrottler" title="apache_beam.io.requestresponse.DefaultThrottler"><code class="xref py py-class docutils literal notranslate"><span class="pre">apache_beam.io.requestresponse.DefaultThrottler</span></code></a> for |
| client-side adaptive throttling using |
| <a class="reference internal" href="apache_beam.io.components.adaptive_throttler.html#apache_beam.io.components.adaptive_throttler.AdaptiveThrottler" title="apache_beam.io.components.adaptive_throttler.AdaptiveThrottler"><code class="xref py py-class docutils literal notranslate"><span class="pre">apache_beam.io.components.adaptive_throttler.AdaptiveThrottler</span></code></a></p></li> |
| </ul> |
| </dd> |
| </dl> |
| <dl class="py method"> |
| <dt class="sig sig-object py" id="apache_beam.io.requestresponse.RequestResponseIO.expand"> |
| <span class="sig-name descname"><span class="pre">expand</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">requests</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="apache_beam.pvalue.html#apache_beam.pvalue.PCollection" title="apache_beam.pvalue.PCollection"><span class="pre">PCollection</span></a><span class="p"><span class="pre">[</span></span><span class="pre">RequestT</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><a class="reference internal" href="apache_beam.pvalue.html#apache_beam.pvalue.PCollection" title="apache_beam.pvalue.PCollection"><span class="pre">PCollection</span></a><span class="p"><span class="pre">[</span></span><span class="pre">ResponseT</span><span class="p"><span class="pre">]</span></span></span></span><a class="reference internal" href="_modules/apache_beam/io/requestresponse.html#RequestResponseIO.expand"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.requestresponse.RequestResponseIO.expand" title="Link to this definition"></a></dt> |
| <dd></dd></dl> |
| |
| </dd></dl> |
| |
| <dl class="py class"> |
| <dt class="sig sig-object py" id="apache_beam.io.requestresponse.ExponentialBackOffRepeater"> |
| <em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">apache_beam.io.requestresponse.</span></span><span class="sig-name descname"><span class="pre">ExponentialBackOffRepeater</span></span><a class="reference internal" href="_modules/apache_beam/io/requestresponse.html#ExponentialBackOffRepeater"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.requestresponse.ExponentialBackOffRepeater" title="Link to this definition"></a></dt> |
| <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Repeater</span></code></p> |
| <p>Configure exponential backoff retry strategy.</p> |
| <p>It retries for exceptions due to the remote service such as |
| TooManyRequests (HTTP 429), UserCodeTimeoutException, UserCodeQuotaException.</p> |
| <p>It utilizes the decorator |
| <a class="reference internal" href="apache_beam.utils.retry.html#apache_beam.utils.retry.with_exponential_backoff" title="apache_beam.utils.retry.with_exponential_backoff"><code class="xref py py-func docutils literal notranslate"><span class="pre">apache_beam.utils.retry.with_exponential_backoff()</span></code></a>.</p> |
| <dl class="py method"> |
| <dt class="sig sig-object py" id="apache_beam.io.requestresponse.ExponentialBackOffRepeater.repeat"> |
| <span class="sig-name descname"><span class="pre">repeat</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">caller</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Caller</span><span class="p"><span class="pre">[</span></span><span class="pre">RequestT</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">ResponseT</span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">request</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">RequestT</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.13)"><span class="pre">float</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">metrics_collector</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">_MetricsCollector</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><span class="pre">None</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">ResponseT</span></span></span><a class="reference internal" href="_modules/apache_beam/io/requestresponse.html#ExponentialBackOffRepeater.repeat"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.requestresponse.ExponentialBackOffRepeater.repeat" title="Link to this definition"></a></dt> |
| <dd><p>repeat method is called from the RequestResponseIO when |
| a repeater is enabled.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters<span class="colon">:</span></dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>caller</strong> – a <cite>~apache_beam.io.requestresponse.Caller</cite> object that |
| calls the API.</p></li> |
| <li><p><strong>request</strong> – input request to repeat.</p></li> |
| <li><p><strong>timeout</strong> – time to wait for the request to complete.</p></li> |
| <li><p><strong>metrics_collector</strong> – (Optional) a |
| <cite>~apache_beam.io.requestresponse._MetricsCollector</cite> object to |
| collect the metrics for RequestResponseIO.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| </dd></dl> |
| |
| <dl class="py class"> |
| <dt class="sig sig-object py" id="apache_beam.io.requestresponse.DefaultThrottler"> |
| <em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">apache_beam.io.requestresponse.</span></span><span class="sig-name descname"><span class="pre">DefaultThrottler</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">window_ms</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><span class="pre">int</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">bucket_ms</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><span class="pre">int</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">overload_ratio</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.13)"><span class="pre">float</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">2</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">delay_secs</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><span class="pre">int</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">5</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/requestresponse.html#DefaultThrottler"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.requestresponse.DefaultThrottler" title="Link to this definition"></a></dt> |
| <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">PreCallThrottler</span></code></p> |
| <p>Default throttler that uses |
| <a class="reference internal" href="apache_beam.io.components.adaptive_throttler.html#apache_beam.io.components.adaptive_throttler.AdaptiveThrottler" title="apache_beam.io.components.adaptive_throttler.AdaptiveThrottler"><code class="xref py py-class docutils literal notranslate"><span class="pre">apache_beam.io.components.adaptive_throttler.AdaptiveThrottler</span></code></a></p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters<span class="colon">:</span></dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>window_ms</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – length of history to consider, in ms, to set throttling.</p></li> |
| <li><p><strong>bucket_ms</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – granularity of time buckets that we store data in, in ms.</p></li> |
| <li><p><strong>overload_ratio</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.13)"><em>float</em></a>) – the target ratio between requests sent and |
| successful requests. This is “K” in the formula in |
| <a class="reference external" href="https://landing.google.com/sre/book/chapters/handling-overload.html">https://landing.google.com/sre/book/chapters/handling-overload.html</a>.</p></li> |
| <li><p><strong>delay_secs</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – minimum number of seconds to throttle a request.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="py class"> |
| <dt class="sig sig-object py" id="apache_beam.io.requestresponse.NoOpsRepeater"> |
| <em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">apache_beam.io.requestresponse.</span></span><span class="sig-name descname"><span class="pre">NoOpsRepeater</span></span><a class="reference internal" href="_modules/apache_beam/io/requestresponse.html#NoOpsRepeater"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.requestresponse.NoOpsRepeater" title="Link to this definition"></a></dt> |
| <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Repeater</span></code></p> |
| <p>Executes a request just once irrespective of any exception.</p> |
| <dl class="py method"> |
| <dt class="sig sig-object py" id="apache_beam.io.requestresponse.NoOpsRepeater.repeat"> |
| <span class="sig-name descname"><span class="pre">repeat</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">caller</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Caller</span><span class="p"><span class="pre">[</span></span><span class="pre">RequestT</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">ResponseT</span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">request</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">RequestT</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">timeout</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#float" title="(in Python v3.13)"><span class="pre">float</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">metrics_collector</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">_MetricsCollector</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><span class="pre">None</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">→</span> <span class="sig-return-typehint"><span class="pre">ResponseT</span></span></span><a class="reference internal" href="_modules/apache_beam/io/requestresponse.html#NoOpsRepeater.repeat"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.requestresponse.NoOpsRepeater.repeat" title="Link to this definition"></a></dt> |
| <dd></dd></dl> |
| |
| </dd></dl> |
| |
| <dl class="py class"> |
| <dt class="sig sig-object py" id="apache_beam.io.requestresponse.RedisCache"> |
| <em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">apache_beam.io.requestresponse.</span></span><span class="sig-name descname"><span class="pre">RedisCache</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">host</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">port</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><span class="pre">int</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">time_to_live</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><span class="pre">int</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.timedelta" title="(in Python v3.13)"><span class="pre">timedelta</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">86400</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">request_coder</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="apache_beam.coders.coders.html#apache_beam.coders.coders.Coder" title="apache_beam.coders.coders.Coder"><span class="pre">Coder</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><span class="pre">None</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">response_coder</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="apache_beam.coders.coders.html#apache_beam.coders.coders.Coder" title="apache_beam.coders.coders.Coder"><span class="pre">Coder</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.13)"><span class="pre">None</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/requestresponse.html#RedisCache"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.requestresponse.RedisCache" title="Link to this definition"></a></dt> |
| <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Cache</span></code></p> |
| <p>Configure cache using Redis for |
| <a class="reference internal" href="#apache_beam.io.requestresponse.RequestResponseIO" title="apache_beam.io.requestresponse.RequestResponseIO"><code class="xref py py-class docutils literal notranslate"><span class="pre">apache_beam.io.requestresponse.RequestResponseIO</span></code></a>.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters<span class="colon">:</span></dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>host</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a>) – The hostname or IP address of the Redis server.</p></li> |
| <li><p><strong>port</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – The port number of the Redis server.</p></li> |
| <li><p><strong>time_to_live</strong> – <cite>(Union[int, timedelta])</cite> The time-to-live (TTL) for |
| records stored in Redis. Provide an integer (in seconds) or a |
| <cite>datetime.timedelta</cite> object.</p></li> |
| <li><p><strong>request_coder</strong> – (Optional[<cite>coders.Coder</cite>]) coder for encoding requests.</p></li> |
| <li><p><strong>response_coder</strong> – (Optional[<cite>coders.Coder</cite>]) coder for decoding responses |
| received from Redis.</p></li> |
| <li><p><strong>kwargs</strong> – Optional additional keyword arguments that |
| are required to connect to your redis server. Same as <cite>redis.Redis()</cite>.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| <dl class="py method"> |
| <dt class="sig sig-object py" id="apache_beam.io.requestresponse.RedisCache.get_read"> |
| <span class="sig-name descname"><span class="pre">get_read</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/requestresponse.html#RedisCache.get_read"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.requestresponse.RedisCache.get_read" title="Link to this definition"></a></dt> |
| <dd><p>get_read returns a PTransform for reading from the cache.</p> |
| </dd></dl> |
| |
| <dl class="py method"> |
| <dt class="sig sig-object py" id="apache_beam.io.requestresponse.RedisCache.get_write"> |
| <span class="sig-name descname"><span class="pre">get_write</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/io/requestresponse.html#RedisCache.get_write"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.io.requestresponse.RedisCache.get_write" title="Link to this definition"></a></dt> |
| <dd><p>returns a PTransform for writing to the cache.</p> |
| </dd></dl> |
| |
| <dl class="py property"> |
| <dt class="sig sig-object py" id="apache_beam.io.requestresponse.RedisCache.source_caller"> |
| <em class="property"><span class="pre">property</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">source_caller</span></span><a class="headerlink" href="#apache_beam.io.requestresponse.RedisCache.source_caller" title="Link to this definition"></a></dt> |
| <dd></dd></dl> |
| |
| <dl class="py property"> |
| <dt class="sig sig-object py" id="apache_beam.io.requestresponse.RedisCache.request_coder"> |
| <em class="property"><span class="pre">property</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">request_coder</span></span><a class="headerlink" href="#apache_beam.io.requestresponse.RedisCache.request_coder" title="Link to this definition"></a></dt> |
| <dd></dd></dl> |
| |
| </dd></dl> |
| |
| </section> |
| |
| |
| </div> |
| </div> |
| <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer"> |
| <a href="apache_beam.io.range_trackers.html" class="btn btn-neutral float-left" title="apache_beam.io.range_trackers module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a> |
| <a href="apache_beam.io.restriction_trackers.html" class="btn btn-neutral float-right" title="apache_beam.io.restriction_trackers module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a> |
| </div> |
| |
| <hr/> |
| |
| <div role="contentinfo"> |
| <p>© Copyright %Y, Apache Beam.</p> |
| </div> |
| |
| Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a |
| <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a> |
| provided by <a href="https://readthedocs.org">Read the Docs</a>. |
| |
| |
| </footer> |
| </div> |
| </div> |
| </section> |
| </div> |
| <script> |
| jQuery(function () { |
| SphinxRtdTheme.Navigation.enable(true); |
| }); |
| </script> |
| |
| </body> |
| </html> |