MCPcopy Index your code
hub / github.com/couchbase/couchbase-python-client / wait_until_ready

Method wait_until_ready

couchbase/cluster.py:223–267  ·  view source on GitHub ↗

Wait until the cluster is ready for use. Check the current connections to see if the desired state has been reached. If not, perform a ping against the specified services. The ping operation will be performed repeatedly with a slight delay in between until the s

(self,
                         timeout,  # type: timedelta
                         *opts,  # type: WaitUntilReadyOptions
                         **kwargs  # type: Dict[str, Any]
                         )

Source from the content-addressed store, hash-verified

221 self._impl.update_credentials(req)
222
223 def wait_until_ready(self,
224 timeout, # type: timedelta
225 *opts, # type: WaitUntilReadyOptions
226 **kwargs # type: Dict[str, Any]
227 ) -> None:
228 """Wait until the cluster is ready for use.
229
230 Check the current connections to see if the desired state has been reached. If not,
231 perform a ping against the specified services. The ping operation will be performed
232 repeatedly with a slight delay in between until the specified timeout has been reached
233 or the cluster is ready for use, whichever comes first.
234
235 .. seealso::
236 * :class:`~couchbase.diagnostics.ServiceType`
237 * :class:`~couchbase.diagnostics.ClusterState`
238
239 Args:
240 timeout (timedelta): Amount of time to wait for cluster to be ready before a
241 :class:`~couchbase.exceptions.UnAmbiguousTimeoutException` is raised.
242 opts (:class:`~couchbase.options.WaitUntilReadyOptions`): Optional parameters for this operation.
243 **kwargs (Dict[str, Any]): keyword arguments that can be used in place or to
244 override provided :class:`~couchbase.options.WaitUntilReadyOptions`
245
246 Raises:
247 :class:`~couchbase.exceptions.UnAmbiguousTimeoutException`: If the specified timeout is reached prior to
248 the cluster being ready for use.
249
250 Example:
251
252 Wait until the cluster is ready to use KV and query services::
253
254 from couchbase.auth import PasswordAuthenticator
255 from couchbase.cluster import Cluster
256 from couchbase.diagnostics import ServiceType
257 from couchbase.options import WaitUntilReadyOptions
258
259 auth = PasswordAuthenticator('username', 'password')
260 cluster = Cluster.connect('couchbase://localhost', ClusterOptions(auth))
261
262 cluster.wait_until_ready(timedelta(seconds=3),
263 WaitUntilReadyOptions(service_types=[ServiceType.KeyValue, ServiceType.Query]))
264
265 """
266 req = self._impl.request_builder.build_wait_until_ready_request(timeout, *opts, **kwargs)
267 self._impl.wait_until_ready(req)
268
269 def query(self,
270 statement, # type: str

Callers 3

mainFunction · 0.95
mainFunction · 0.95

Calls 1

Tested by

no test coverage detected