def ensure_running(retries=15, wait=10):
    """Ensure cassandra is running on all nodes.
    Runs 'nodetool ring' on a single node continuously until it
    reaches the specified number of retries.

    INTENDED TO BE RUN ON ONE NODE, NOT ALL.
    """
    time.sleep(15)
    for attempt in range(retries):
        ring = StringIO(fab.run('JAVA_HOME={java_home} {nodetool_bin} ring'.format(
            java_home=config['java_home'], nodetool_bin=_nodetool_cmd())))
        broadcast_ips = [x.get('external_ip', x['internal_ip']) for x in config['hosts'].values()]
        nodes_up = dict((host,False) for host in broadcast_ips)
        for line in ring:
            for host in broadcast_ips:
                try:
                    if host in line and " Up " in line:
                        nodes_up[host] = True
                except UnicodeDecodeError:
                    # sometimes the operations on line will fail when it contains characters
                    # outside ascii range. we don't care; these lines can exist as long as
                    # we see the 'UP' lines that let us know a node is up.
                    pass
        for node,up in nodes_up.items():
            if not up:
                fab.puts("Node is not up (yet): %s" % node)
        if False not in nodes_up.values():
            fab.puts("All nodes available!")
            return
        fab.puts(wait % "waiting %d seconds to try again..")
        time.sleep(wait)
    else:
        fab.abort("Timed out waiting for all nodes to startup")
dataset/ETHPy150Open datastax/cstar_perf/tool/cstar_perf/tool/fab_common.py/ensure_running/swapped operands of `%`