Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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":
(stdout, stderr) = hc.execute("fs -lsr /", verbose=False)
print ""
for line in stdout.splitlines():
if not "WARN fs.FileSystem" in line:
print line
print ""
(stdout, stderr) = hc.execute("fs -dus /", verbose=False)
pos = stdout.rfind("\t")
size = int(stdout[pos + 1:])
human_readable_size = ""
if 1024 < size < 1024*1024:
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":
(stdout, stderr) = hc.execute("fs -lsr /", verbose=False)
print ""
for line in stdout.splitlines():
if not "WARN fs.FileSystem" in line:
print line
print ""
(stdout, stderr) = hc.execute("fs -dus /", verbose=False)
pos = stdout.rfind("\t")
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":
(stdout, stderr) = hc.execute("fs -lsr /", verbose=False)
print ""
for line in stdout.splitlines():
if not "WARN fs.FileSystem" in line:
print line
print ""
(stdout, stderr) = hc.execute("fs -dus /", verbose=False)
pos = stdout.rfind("\t")
size = int(stdout[pos + 1:])