in cstar/strategy.py [0:0]
def find_next_host(strategy, topology, endpoint_mapping, progress, cluster_parallel, dc_parallel, max_concurrency,
stop_after, ignore_down_nodes):
"""Entry point for figuring out which host to do things on next."""
if stop_after and ((len(progress.running) + len(progress.done) + len(progress.failed)) >= stop_after):
return None
remaining = topology.without_hosts(progress.done).without_hosts(progress.running).without_hosts(progress.failed)
if progress.running and not cluster_parallel:
remaining = remaining.with_cluster(next(iter(progress.running)).cluster)
if progress.running and not dc_parallel:
remaining = remaining.with_dc_or_distinct_cluster(progress.running)
if not remaining:
return None
if max_concurrency and (len(progress.running) >= max_concurrency):
return None
if not ignore_down_nodes:
for host in remaining:
if not host.is_up:
raise HostIsDown(host)
return _strategy_mapping[strategy](remaining, endpoint_mapping, progress.running)