MCPcopy Index your code
hub / github.com/apache/cassandra-python-driver / prepare_on_all_hosts

Method prepare_on_all_hosts

cassandra/cluster.py:3207–3239  ·  view source on GitHub ↗

Prepare the given query on all hosts, excluding ``excluded_host``. Intended for internal use only.

(self, query, excluded_host, keyspace=None)

Source from the content-addressed store, hash-verified

3205 return prepared_statement
3206
3207 def prepare_on_all_hosts(self, query, excluded_host, keyspace=None):
3208 """
3209 Prepare the given query on all hosts, excluding ``excluded_host``.
3210 Intended for internal use only.
3211 """
3212 futures = []
3213 for host in tuple(self._pools.keys()):
3214 if host != excluded_host and host.is_up:
3215 future = ResponseFuture(self, PrepareMessage(query=query, keyspace=keyspace),
3216 None, self.default_timeout)
3217
3218 # we don't care about errors preparing against specific hosts,
3219 # since we can always prepare them as needed when the prepared
3220 # statement is used. Just log errors and continue on.
3221 try:
3222 request_id = future._query(host)
3223 except Exception:
3224 log.exception("Error preparing query for host %s:", host)
3225 continue
3226
3227 if request_id is None:
3228 # the error has already been logged by ResponseFuture
3229 log.debug("Failed to prepare query for host %s: %r",
3230 host, future._errors.get(host))
3231 continue
3232
3233 futures.append((host, future))
3234
3235 for host, future in futures:
3236 try:
3237 future.result()
3238 except Exception:
3239 log.exception("Error preparing query for host %s:", host)
3240
3241 def shutdown(self):
3242 """

Callers 1

prepareMethod · 0.95

Calls 6

_queryMethod · 0.95
resultMethod · 0.95
PrepareMessageClass · 0.90
ResponseFutureClass · 0.85
keysMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected