'Intended for internal use only.'

def on_up(self, host):

    if self.is_shutdown:
        return
    log.debug('Waiting    to    acquire    lock    for    handling    up    status    of    node    %s', host)
    with host.lock:
        if host._currently_handling_node_up:
            log.debug('Another    thread    is    already    handling    up    status    of    node    %s', host)
            return
        if host.is_up:
            log.debug('Host    %s    was    already    marked    up', host)
            return
        host._currently_handling_node_up = True
    log.debug('Starting    to    handle    up    status    of    node    %s', host)
    have_future = False
    futures = set()
    try:
        log.info('Host    %s    may    be    up;    will    prepare    queries    and    open    connection    pool', host)
        reconnector = host.get_and_set_reconnection_handler(None)
        if reconnector:
            log.debug('Now    that    host    %s    is    up,    cancelling    the    reconnection    handler', host)
            reconnector.cancel()
        if (self.profile_manager.distance(host) != HostDistance.IGNORED):
            self._prepare_all_queries(host)
            log.debug('Done    preparing    all    queries    for    host    %s,    ', host)
        for session in self.sessions:
            session.remove_pool(host)
        log.debug('Signalling    to    load    balancing    policies    that    host    %s    is    up', host)
        self.profile_manager.on_up(host)
        log.debug('Signalling    to    control    connection    that    host    %s    is    up', host)
        self.control_connection.on_up(host)
        log.debug('Attempting    to    open    new    connection    pools    for    host    %s', host)
        futures_lock = Lock()
        futures_results = []
        callback = partial(self._on_up_future_completed, host, futures, futures_results, futures_lock)
        for session in self.sessions:
            future = session.add_or_renew_pool(host, is_host_addition=False)
            if (future is not None):
                have_future = True
                future.add_done_callback(callback)
                futures.add(future)
    except Exception:
        log.exception('Unexpected    failure    handling    node    %s    being    marked    up:', host)
        for future in futures:
            future.cancel()
        self._cleanup_failed_on_up_handling(host)
        with host.lock:
            host._currently_handling_node_up = False
        raise
    else:
        if (not have_future):
            with host.lock:
                host.set_up()
                host._currently_handling_node_up = False
    return futures
