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

Method on_up

cassandra/cluster.py:1842–1912  ·  view source on GitHub ↗

Intended for internal use only.

(self, host)

Source from the content-addressed store, hash-verified

1840 session.update_created_pools()
1841
1842 def on_up(self, host):
1843 """
1844 Intended for internal use only.
1845 """
1846 if self.is_shutdown:
1847 return
1848
1849 log.debug("Waiting to acquire lock for handling up status of node %s", host)
1850 with host.lock:
1851 if host._currently_handling_node_up:
1852 log.debug("Another thread is already handling up status of node %s", host)
1853 return
1854
1855 if host.is_up:
1856 log.debug("Host %s was already marked up", host)
1857 return
1858
1859 host._currently_handling_node_up = True
1860 log.debug("Starting to handle up status of node %s", host)
1861
1862 have_future = False
1863 futures = set()
1864 try:
1865 log.info("Host %s may be up; will prepare queries and open connection pool", host)
1866
1867 reconnector = host.get_and_set_reconnection_handler(None)
1868 if reconnector:
1869 log.debug("Now that host %s is up, cancelling the reconnection handler", host)
1870 reconnector.cancel()
1871
1872 if self.profile_manager.distance(host) != HostDistance.IGNORED:
1873 self._prepare_all_queries(host)
1874 log.debug("Done preparing all queries for host %s, ", host)
1875
1876 for session in tuple(self.sessions):
1877 session.remove_pool(host)
1878
1879 log.debug("Signalling to load balancing policies that host %s is up", host)
1880 self.profile_manager.on_up(host)
1881
1882 log.debug("Signalling to control connection that host %s is up", host)
1883 self.control_connection.on_up(host)
1884
1885 log.debug("Attempting to open new connection pools for host %s", host)
1886 futures_lock = Lock()
1887 futures_results = []
1888 callback = partial(self._on_up_future_completed, host, futures, futures_results, futures_lock)
1889 for session in tuple(self.sessions):
1890 future = session.add_or_renew_pool(host, is_host_addition=False)
1891 if future is not None:
1892 have_future = True
1893 future.add_done_callback(callback)
1894 futures.add(future)
1895 except Exception:
1896 log.exception("Unexpected failure handling node %s being marked up:", host)
1897 for future in futures:
1898 future.cancel()
1899

Callers 5

on_upMethod · 0.45
add_execution_profileMethod · 0.45
_update_location_infoMethod · 0.45
on_reconnectionMethod · 0.45

Calls 10

_prepare_all_queriesMethod · 0.95
setFunction · 0.85
remove_poolMethod · 0.80
add_or_renew_poolMethod · 0.80
set_upMethod · 0.80
cancelMethod · 0.45
distanceMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected