Skip to content

Commit 6226e74

Browse files
committed
add some missing Cluster attibutes
1 parent b875615 commit 6226e74

6 files changed

Lines changed: 112 additions & 48 deletions

File tree

‎_modules/cassandra/cluster.html‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,8 +684,10 @@ <h1>Source code for cassandra.cluster</h1><div class="highlight"><pre>
684684
<span class="n">prepare_on_all_hosts</span><span class="o">=</span><span class="bp">True</span><span class="p">,</span>
685685
<span class="n">reprepare_on_up</span><span class="o">=</span><span class="bp">True</span><span class="p">):</span>
686686
<span class="sd">&quot;&quot;&quot;</span>
687-
<span class="sd"> Any of the mutable Cluster attributes may be set as keyword arguments</span>
688-
<span class="sd"> to the constructor.</span>
687+
<span class="sd"> ``executor_threads`` defines the number of threads in a pool for handling asynchronous tasks such as</span>
688+
<span class="sd"> extablishing connection pools or refreshing metadata.</span>
689+
690+
<span class="sd"> Any of the mutable Cluster attributes may be set as keyword arguments to the constructor.</span>
689691
<span class="sd"> &quot;&quot;&quot;</span>
690692
<span class="k">if</span> <span class="n">contact_points</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span>
691693
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">contact_points</span><span class="p">,</span> <span class="n">six</span><span class="o">.</span><span class="n">string_types</span><span class="p">):</span>

‎_sources/api/cassandra/cluster.txt‎

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55

66
.. autoclass:: Cluster ([contact_points=('127.0.0.1',)][, port=9042][, executor_threads=2], **attr_kwargs)
77

8-
Any of the mutable Cluster attributes may be set as keyword arguments to the constructor.
8+
.. autoattribute:: contact_points
9+
10+
.. autoattribute:: port
911

1012
.. autoattribute:: cql_version
1113

1214
.. autoattribute:: protocol_version
1315

14-
.. autoattribute:: port
15-
1616
.. autoattribute:: compression
1717

1818
.. autoattribute:: auth_provider
@@ -27,20 +27,20 @@
2727

2828
.. autoattribute:: address_translator
2929

30-
.. autoattribute:: connection_class
31-
3230
.. autoattribute:: metrics_enabled
3331

3432
.. autoattribute:: metrics
3533

36-
.. autoattribute:: metadata
37-
3834
.. autoattribute:: ssl_options
3935

4036
.. autoattribute:: sockopts
4137

4238
.. autoattribute:: max_schema_agreement_wait
4339

40+
.. autoattribute:: metadata
41+
42+
.. autoattribute:: connection_class
43+
4444
.. autoattribute:: control_connection_timeout
4545

4646
.. autoattribute:: idle_heartbeat_interval
@@ -49,6 +49,12 @@
4949

5050
.. autoattribute:: topology_event_refresh_window
5151

52+
.. autoattribute:: status_event_refresh_window
53+
54+
.. autoattribute:: prepare_on_all_hosts
55+
56+
.. autoattribute:: reprepare_on_up
57+
5258
.. autoattribute:: connect_timeout
5359

5460
.. autoattribute:: schema_metadata_enabled

‎api/cassandra/cluster.html‎

Lines changed: 73 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,26 @@ <h3>Quick search</h3>
103103
</div>
104104
<p><code class="docutils literal"><span class="pre">Cluster</span></code> and <code class="docutils literal"><span class="pre">Session</span></code> also provide context management functions
105105
which implicitly handle shutdown when leaving scope.</p>
106-
<p>Any of the mutable Cluster attributes may be set as keyword arguments
107-
to the constructor.</p>
106+
<p><code class="docutils literal"><span class="pre">executor_threads</span></code> defines the number of threads in a pool for handling asynchronous tasks such as
107+
extablishing connection pools or refreshing metadata.</p>
108108
<p>Any of the mutable Cluster attributes may be set as keyword arguments to the constructor.</p>
109+
<dl class="attribute">
110+
<dt id="cassandra.cluster.Cluster.contact_points">
111+
<code class="descname">contact_points</code><em class="property"> = ['127.0.0.1']</em><a class="headerlink" href="#cassandra.cluster.Cluster.contact_points" title="Permalink to this definition"></a></dt>
112+
<dd><p>The list of contact points to try connecting for cluster discovery.</p>
113+
<p>Defaults to loopback interface.</p>
114+
<p>Note: When using <code class="xref py py-class docutils literal"><span class="pre">DCAwareLoadBalancingPolicy</span></code> with no explicit
115+
local_dc set (as is the default), the DC is chosen from an arbitrary
116+
host in contact_points. In this case, contact_points should contain
117+
only nodes from a single, local DC.</p>
118+
</dd></dl>
119+
120+
<dl class="attribute">
121+
<dt id="cassandra.cluster.Cluster.port">
122+
<code class="descname">port</code><em class="property"> = 9042</em><a class="headerlink" href="#cassandra.cluster.Cluster.port" title="Permalink to this definition"></a></dt>
123+
<dd><p>The server-side port to open connections to. Defaults to 9042.</p>
124+
</dd></dl>
125+
109126
<dl class="attribute">
110127
<dt id="cassandra.cluster.Cluster.cql_version">
111128
<code class="descname">cql_version</code><em class="property"> = None</em><a class="headerlink" href="#cassandra.cluster.Cluster.cql_version" title="Permalink to this definition"></a></dt>
@@ -161,12 +178,6 @@ <h3>Quick search</h3>
161178
</table>
162179
</dd></dl>
163180

164-
<dl class="attribute">
165-
<dt id="cassandra.cluster.Cluster.port">
166-
<code class="descname">port</code><em class="property"> = 9042</em><a class="headerlink" href="#cassandra.cluster.Cluster.port" title="Permalink to this definition"></a></dt>
167-
<dd><p>The server-side port to open connections to. Defaults to 9042.</p>
168-
</dd></dl>
169-
170181
<dl class="attribute">
171182
<dt id="cassandra.cluster.Cluster.compression">
172183
<code class="descname">compression</code><em class="property"> = True</em><a class="headerlink" href="#cassandra.cluster.Cluster.compression" title="Permalink to this definition"></a></dt>
@@ -237,25 +248,6 @@ <h3>Quick search</h3>
237248
to driver connection addresses.</p>
238249
</dd></dl>
239250

240-
<dl class="attribute">
241-
<dt id="cassandra.cluster.Cluster.connection_class">
242-
<code class="descname">connection_class</code><em class="property"> = &lt;class 'cassandra.io.libevreactor.LibevConnection'&gt;</em><a class="headerlink" href="#cassandra.cluster.Cluster.connection_class" title="Permalink to this definition"></a></dt>
243-
<dd><p>This determines what event loop system will be used for managing
244-
I/O with Cassandra. These are the current options:</p>
245-
<ul class="simple">
246-
<li><a class="reference internal" href="io/asyncorereactor.html#cassandra.io.asyncorereactor.AsyncoreConnection" title="cassandra.io.asyncorereactor.AsyncoreConnection"><code class="xref py py-class docutils literal"><span class="pre">cassandra.io.asyncorereactor.AsyncoreConnection</span></code></a></li>
247-
<li><a class="reference internal" href="io/libevreactor.html#cassandra.io.libevreactor.LibevConnection" title="cassandra.io.libevreactor.LibevConnection"><code class="xref py py-class docutils literal"><span class="pre">cassandra.io.libevreactor.LibevConnection</span></code></a></li>
248-
<li><a class="reference internal" href="io/eventletreactor.html#cassandra.io.eventletreactor.EventletConnection" title="cassandra.io.eventletreactor.EventletConnection"><code class="xref py py-class docutils literal"><span class="pre">cassandra.io.eventletreactor.EventletConnection</span></code></a> (requires monkey-patching - see doc for details)</li>
249-
<li><a class="reference internal" href="io/geventreactor.html#cassandra.io.geventreactor.GeventConnection" title="cassandra.io.geventreactor.GeventConnection"><code class="xref py py-class docutils literal"><span class="pre">cassandra.io.geventreactor.GeventConnection</span></code></a> (requires monkey-patching - see doc for details)</li>
250-
<li><a class="reference internal" href="io/twistedreactor.html#cassandra.io.twistedreactor.TwistedConnection" title="cassandra.io.twistedreactor.TwistedConnection"><code class="xref py py-class docutils literal"><span class="pre">cassandra.io.twistedreactor.TwistedConnection</span></code></a></li>
251-
</ul>
252-
<p>By default, <code class="docutils literal"><span class="pre">AsyncoreConnection</span></code> will be used, which uses
253-
the <code class="docutils literal"><span class="pre">asyncore</span></code> module in the Python standard library.</p>
254-
<p>If <code class="docutils literal"><span class="pre">libev</span></code> is installed, <code class="docutils literal"><span class="pre">LibevConnection</span></code> will be used instead.</p>
255-
<p>If <code class="docutils literal"><span class="pre">gevent</span></code> or <code class="docutils literal"><span class="pre">eventlet</span></code> monkey-patching is detected, the corresponding
256-
connection class will be used automatically.</p>
257-
</dd></dl>
258-
259251
<dl class="attribute">
260252
<dt id="cassandra.cluster.Cluster.metrics_enabled">
261253
<code class="descname">metrics_enabled</code><em class="property"> = False</em><a class="headerlink" href="#cassandra.cluster.Cluster.metrics_enabled" title="Permalink to this definition"></a></dt>
@@ -270,12 +262,6 @@ <h3>Quick search</h3>
270262
<code class="xref py py-const docutils literal"><span class="pre">True</span></code>, else <code class="xref py py-const docutils literal"><span class="pre">None</span></code>.</p>
271263
</dd></dl>
272264

273-
<dl class="attribute">
274-
<dt id="cassandra.cluster.Cluster.metadata">
275-
<code class="descname">metadata</code><em class="property"> = None</em><a class="headerlink" href="#cassandra.cluster.Cluster.metadata" title="Permalink to this definition"></a></dt>
276-
<dd><p>An instance of <a class="reference internal" href="metadata.html#cassandra.metadata.Metadata" title="cassandra.metadata.Metadata"><code class="xref py py-class docutils literal"><span class="pre">cassandra.metadata.Metadata</span></code></a>.</p>
277-
</dd></dl>
278-
279265
<dl class="attribute">
280266
<dt id="cassandra.cluster.Cluster.ssl_options">
281267
<code class="descname">ssl_options</code><em class="property"> = None</em><a class="headerlink" href="#cassandra.cluster.Cluster.ssl_options" title="Permalink to this definition"></a></dt>
@@ -314,6 +300,31 @@ <h3>Quick search</h3>
314300
If set &lt;= 0, the driver will bypass schema agreement waits altogether.</p>
315301
</dd></dl>
316302

303+
<dl class="attribute">
304+
<dt id="cassandra.cluster.Cluster.metadata">
305+
<code class="descname">metadata</code><em class="property"> = None</em><a class="headerlink" href="#cassandra.cluster.Cluster.metadata" title="Permalink to this definition"></a></dt>
306+
<dd><p>An instance of <a class="reference internal" href="metadata.html#cassandra.metadata.Metadata" title="cassandra.metadata.Metadata"><code class="xref py py-class docutils literal"><span class="pre">cassandra.metadata.Metadata</span></code></a>.</p>
307+
</dd></dl>
308+
309+
<dl class="attribute">
310+
<dt id="cassandra.cluster.Cluster.connection_class">
311+
<code class="descname">connection_class</code><em class="property"> = &lt;class 'cassandra.io.libevreactor.LibevConnection'&gt;</em><a class="headerlink" href="#cassandra.cluster.Cluster.connection_class" title="Permalink to this definition"></a></dt>
312+
<dd><p>This determines what event loop system will be used for managing
313+
I/O with Cassandra. These are the current options:</p>
314+
<ul class="simple">
315+
<li><a class="reference internal" href="io/asyncorereactor.html#cassandra.io.asyncorereactor.AsyncoreConnection" title="cassandra.io.asyncorereactor.AsyncoreConnection"><code class="xref py py-class docutils literal"><span class="pre">cassandra.io.asyncorereactor.AsyncoreConnection</span></code></a></li>
316+
<li><a class="reference internal" href="io/libevreactor.html#cassandra.io.libevreactor.LibevConnection" title="cassandra.io.libevreactor.LibevConnection"><code class="xref py py-class docutils literal"><span class="pre">cassandra.io.libevreactor.LibevConnection</span></code></a></li>
317+
<li><a class="reference internal" href="io/eventletreactor.html#cassandra.io.eventletreactor.EventletConnection" title="cassandra.io.eventletreactor.EventletConnection"><code class="xref py py-class docutils literal"><span class="pre">cassandra.io.eventletreactor.EventletConnection</span></code></a> (requires monkey-patching - see doc for details)</li>
318+
<li><a class="reference internal" href="io/geventreactor.html#cassandra.io.geventreactor.GeventConnection" title="cassandra.io.geventreactor.GeventConnection"><code class="xref py py-class docutils literal"><span class="pre">cassandra.io.geventreactor.GeventConnection</span></code></a> (requires monkey-patching - see doc for details)</li>
319+
<li><a class="reference internal" href="io/twistedreactor.html#cassandra.io.twistedreactor.TwistedConnection" title="cassandra.io.twistedreactor.TwistedConnection"><code class="xref py py-class docutils literal"><span class="pre">cassandra.io.twistedreactor.TwistedConnection</span></code></a></li>
320+
</ul>
321+
<p>By default, <code class="docutils literal"><span class="pre">AsyncoreConnection</span></code> will be used, which uses
322+
the <code class="docutils literal"><span class="pre">asyncore</span></code> module in the Python standard library.</p>
323+
<p>If <code class="docutils literal"><span class="pre">libev</span></code> is installed, <code class="docutils literal"><span class="pre">LibevConnection</span></code> will be used instead.</p>
324+
<p>If <code class="docutils literal"><span class="pre">gevent</span></code> or <code class="docutils literal"><span class="pre">eventlet</span></code> monkey-patching is detected, the corresponding
325+
connection class will be used automatically.</p>
326+
</dd></dl>
327+
317328
<dl class="attribute">
318329
<dt id="cassandra.cluster.Cluster.control_connection_timeout">
319330
<code class="descname">control_connection_timeout</code><em class="property"> = 2.0</em><a class="headerlink" href="#cassandra.cluster.Cluster.control_connection_timeout" title="Permalink to this definition"></a></dt>
@@ -358,6 +369,35 @@ <h3>Quick search</h3>
358369
<p>See <a class="reference internal" href="#cassandra.cluster.Cluster.schema_event_refresh_window" title="cassandra.cluster.Cluster.schema_event_refresh_window"><code class="xref py py-attr docutils literal"><span class="pre">schema_event_refresh_window</span></code></a> for discussion of rationale</p>
359370
</dd></dl>
360371

372+
<dl class="attribute">
373+
<dt id="cassandra.cluster.Cluster.status_event_refresh_window">
374+
<code class="descname">status_event_refresh_window</code><em class="property"> = 2</em><a class="headerlink" href="#cassandra.cluster.Cluster.status_event_refresh_window" title="Permalink to this definition"></a></dt>
375+
<dd><p>Window, in seconds, within which the driver will start the reconnect after
376+
receiving a status_change event.</p>
377+
<p>Setting this to zero will connect immediately.</p>
378+
<p>This is primarily used to avoid &#8216;thundering herd&#8217; in deployments with large fanout from cluster to clients.
379+
When nodes come up, clients attempt to reprepare prepared statements (depending on <a class="reference internal" href="#cassandra.cluster.Cluster.reprepare_on_up" title="cassandra.cluster.Cluster.reprepare_on_up"><code class="xref py py-attr docutils literal"><span class="pre">reprepare_on_up</span></code></a>), and
380+
establish connection pools. This can cause a rush of connections and queries if not mitigated with this factor.</p>
381+
</dd></dl>
382+
383+
<dl class="attribute">
384+
<dt id="cassandra.cluster.Cluster.prepare_on_all_hosts">
385+
<code class="descname">prepare_on_all_hosts</code><em class="property"> = True</em><a class="headerlink" href="#cassandra.cluster.Cluster.prepare_on_all_hosts" title="Permalink to this definition"></a></dt>
386+
<dd><p>Specifies whether statements should be prepared on all hosts, or just one.</p>
387+
<p>This can reasonably be disabled on long-running applications with numerous clients preparing statements on startup,
388+
where a randomized initial condition of the load balancing policy can be expected to distribute prepares from
389+
different clients across the cluster.</p>
390+
</dd></dl>
391+
392+
<dl class="attribute">
393+
<dt id="cassandra.cluster.Cluster.reprepare_on_up">
394+
<code class="descname">reprepare_on_up</code><em class="property"> = True</em><a class="headerlink" href="#cassandra.cluster.Cluster.reprepare_on_up" title="Permalink to this definition"></a></dt>
395+
<dd><p>Specifies whether all known prepared statements should be prepared on a node when it comes up.</p>
396+
<p>May be used to avoid overwhelming a node on return, or if it is supposed that the node was only marked down due to
397+
network. If statements are not reprepared, they are prepared on the first execution, causing
398+
an extra roundtrip for one or more client requests.</p>
399+
</dd></dl>
400+
361401
<dl class="attribute">
362402
<dt id="cassandra.cluster.Cluster.connect_timeout">
363403
<code class="descname">connect_timeout</code><em class="property"> = 5</em><a class="headerlink" href="#cassandra.cluster.Cluster.connect_timeout" title="Permalink to this definition"></a></dt>

‎genindex.html‎

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -595,12 +595,12 @@ <h2 id="C">C</h2>
595595
<dt><a href="api/cassandra/metrics.html#cassandra.metrics.Metrics.connected_to">connected_to (cassandra.metrics.Metrics attribute)</a>
596596
</dt>
597597

598-
</dl></td>
599-
<td style="width: 33%" valign="top"><dl>
600598

601599
<dt><a href="api/cassandra/cluster.html#cassandra.cluster.Cluster.connection_class">connection_class (cassandra.cluster.Cluster attribute)</a>
602600
</dt>
603601

602+
</dl></td>
603+
<td style="width: 33%" valign="top"><dl>
604604

605605
<dt><a href="api/cassandra/metrics.html#cassandra.metrics.Metrics.connection_errors">connection_errors (cassandra.metrics.Metrics attribute)</a>
606606
</dt>
@@ -648,6 +648,10 @@ <h2 id="C">C</h2>
648648
</dt>
649649

650650

651+
<dt><a href="api/cassandra/cluster.html#cassandra.cluster.Cluster.contact_points">contact_points (cassandra.cluster.Cluster attribute)</a>
652+
</dt>
653+
654+
651655
<dt><a href="api/cassandra/cluster.html#cassandra.cluster.Cluster.control_connection_timeout">control_connection_timeout (cassandra.cluster.Cluster attribute)</a>
652656
</dt>
653657

@@ -1808,6 +1812,10 @@ <h2 id="P">P</h2>
18081812
</dt>
18091813

18101814

1815+
<dt><a href="api/cassandra/cluster.html#cassandra.cluster.Cluster.prepare_on_all_hosts">prepare_on_all_hosts (cassandra.cluster.Cluster attribute)</a>
1816+
</dt>
1817+
1818+
18111819
<dt><a href="api/cassandra/query.html#cassandra.query.BoundStatement.prepared_statement">prepared_statement (cassandra.query.BoundStatement attribute)</a>
18121820
</dt>
18131821

@@ -1954,12 +1962,16 @@ <h2 id="R">R</h2>
19541962
</dt>
19551963

19561964

1957-
<dt><a href="api/cassandra/metrics.html#cassandra.metrics.Metrics.request_timer">request_timer (cassandra.metrics.Metrics attribute)</a>
1965+
<dt><a href="api/cassandra/cluster.html#cassandra.cluster.Cluster.reprepare_on_up">reprepare_on_up (cassandra.cluster.Cluster attribute)</a>
19581966
</dt>
19591967

19601968
</dl></td>
19611969
<td style="width: 33%" valign="top"><dl>
19621970

1971+
<dt><a href="api/cassandra/metrics.html#cassandra.metrics.Metrics.request_timer">request_timer (cassandra.metrics.Metrics attribute)</a>
1972+
</dt>
1973+
1974+
19631975
<dt><a href="api/cassandra/query.html#cassandra.query.QueryTrace.request_type">request_type (cassandra.query.QueryTrace attribute)</a>
19641976
</dt>
19651977

@@ -2151,8 +2163,6 @@ <h2 id="S">S</h2>
21512163
<dt><a href="api/cassandra/cqlengine/connection.html#cassandra.cqlengine.connection.setup">setup() (in module cassandra.cqlengine.connection)</a>
21522164
</dt>
21532165

2154-
</dl></td>
2155-
<td style="width: 33%" valign="top"><dl>
21562166

21572167
<dt><a href="api/cassandra/cluster.html#cassandra.cluster.Cluster.shutdown">shutdown() (cassandra.cluster.Cluster method)</a>
21582168
</dt>
@@ -2163,6 +2173,8 @@ <h2 id="S">S</h2>
21632173
</dt>
21642174

21652175
</dl></dd>
2176+
</dl></td>
2177+
<td style="width: 33%" valign="top"><dl>
21662178

21672179
<dt><a href="api/cassandra.html#cassandra.UserAggregateDescriptor.signature">signature (cassandra.UserAggregateDescriptor attribute)</a>
21682180
</dt>
@@ -2242,6 +2254,10 @@ <h2 id="S">S</h2>
22422254
</dt>
22432255

22442256

2257+
<dt><a href="api/cassandra/cluster.html#cassandra.cluster.Cluster.status_event_refresh_window">status_event_refresh_window (cassandra.cluster.Cluster attribute)</a>
2258+
</dt>
2259+
2260+
22452261
<dt><a href="api/cassandra/cqlengine/management.html#cassandra.cqlengine.management.sync_table">sync_table() (in module cassandra.cqlengine.management)</a>
22462262
</dt>
22472263

‎objects.inv‎

32 Bytes
Binary file not shown.

‎searchindex.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)