Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.hosts = list(hosts)
self.master = self.hosts[0]
# Create topology
self.topology = HadoopTopology(hosts, topo_list)
# Store cluster information
self.hw = hw_manager.make_deployment_hardware()
self.hw.add_hosts(self.hosts)
self.master_cluster = self.hw.get_host_cluster(self.master)
# Create a string to display the topology
t = {v: [] for v in self.topology.topology.values()}
for key, value in self.topology.topology.iteritems():
t[value].append(key.address)
log_topo = ', '.join([style.user2(k) + ': ' +
' '.join(map(lambda x: style.host(x.split('.')[0]), v))
for k, v in t.iteritems()])
logger.info("Hadoop cluster created with master %s, hosts %s and "
"topology %s",
style.host(self.master.address),
' '.join([style.host(h.address.split('.')[0])
for h in self.hosts]),
log_topo)
hc.execute_jar(HadoopJarJob(args.jarjob[0]), verbose=verbose)
if args.copyhistory:
hc.copy_history(args.copyhistory[0])
if args.stop:
hc.stop()
if args.clean:
hc.clean()
if args.state:
if args.state == "general":
logger.info("---------------------------------------------------------")
logger.info(style.user2("Hadoop Cluster with ID " + str(hc_id)))
logger.info(style.user1(" Version: ") + hc.get_version())
logger.info(style.user1(" Master: ") + str(hc.master))
logger.info(style.user1(" Hosts: ") + str(hc.hosts))
logger.info(style.user1(" Topology: "))
for h in hc.hosts:
logger.info(" " + str(h) + " -> " + str(hc.topology.get_rack(h)))
if hc.initialized:
if hc.running:
logger.info("The cluster is " + style.user3("running"))
else:
logger.info("The cluster is " + style.user3("stopped"))
else:
logger.info("The cluster is not " + style.user3("initialized"))
logger.info("---------------------------------------------------------")
elif args.state == "files":