in cstar/job.py [0:0]
def setup(self, hosts, seeds, command, job_id, strategy, cluster_parallel, dc_parallel, job_runner,
max_concurrency, timeout, env, use_sudo, sudo_args, stop_after, key_space, output_directory,
ignore_down_nodes, dc_filter,
sleep_on_new_runner, sleep_after_done,
ssh_username, ssh_password, ssh_identity_file, ssh_lib,
jmx_username, jmx_password, jmx_passwordfile, addl_jmx_args,
resolve_hostnames, hosts_variables):
msg("Starting setup")
msg("Strategy:", cstar.strategy.serialize(strategy))
msg("Cluster parallel:", cluster_parallel)
msg("DC parallel:", dc_parallel)
self.command = command
self.job_id = job_id
self.timeout = timeout
self.env = env
self.job_runner = job_runner
self.key_space = key_space
self.output_directory = output_directory or os.path.expanduser("~/.cstar/jobs/" + job_id)
self.cache_directory = os.path.expanduser("~/.cstar/cache")
self.sleep_on_new_runner = sleep_on_new_runner
self.sleep_after_done = sleep_after_done
self.ssh_username = ssh_username
self.ssh_password = ssh_password
self.ssh_identity_file = ssh_identity_file
self.ssh_lib = ssh_lib
self.use_sudo = use_sudo
self.sudo_args = sudo_args
self.jmx_username = jmx_username
self.jmx_password = jmx_password
self.jmx_passwordfile = jmx_passwordfile
self.addl_jmx_args = addl_jmx_args
self.resolve_hostnames = resolve_hostnames
self.hosts_variables = hosts_variables
if not os.path.exists(self.output_directory):
os.makedirs(self.output_directory)
if not os.path.exists(self.cache_directory):
os.makedirs(self.cache_directory)
msg("Loading cluster topology")
if seeds:
current_topology = cstar.topology.Topology([])
current_topology = current_topology | self.get_cluster_topology(seeds)
original_topology = current_topology
if dc_filter:
original_topology = original_topology.with_dc_filter(dc_filter)
else:
current_topology = cstar.topology.Topology()
hosts_ip_set = set(socket.gethostbyname(host) for host in hosts)
for raw_host in hosts:
host = socket.gethostbyname(raw_host)
if host in current_topology:
continue
current_topology = current_topology | self.get_cluster_topology((host,))
original_topology = cstar.topology.Topology(host for host in current_topology if host.ip in hosts_ip_set)
msg("Done loading cluster topology")
debug("Run on hosts", original_topology)
debug("in topology", current_topology)
msg("Generating endpoint mapping")
if strategy is cstar.strategy.Strategy.TOPOLOGY:
endpoint_mapping = self.get_endpoint_mapping(current_topology)
msg("Done generating endpoint mapping")
else:
endpoint_mapping = None
msg("Skipping endpoint mapping because of selected strategy")
self.state = cstar.state.State(original_topology, strategy, endpoint_mapping,
cluster_parallel, dc_parallel, dc_filter=dc_filter,
max_concurrency=max_concurrency, current_topology=current_topology,
stop_after=stop_after, ignore_down_nodes=ignore_down_nodes)
msg("Setup done")