def display_status(status_data):
for session in status_data:
# Display heading and initiate table
print "SESSION: " + session[0]
table = PrettyTable(["MASTER", "STATUS",
"CRAWL STATUS", "SLAVE NODE", "LAST SYNCED",
"CHKPT TIME", "CHKPT COMPLETED",
"CHKPT COMPLETION TIME"])
for row in session[2]:
table.add_row([row["master_node"] + ":" + row["master_brick"],
row["status"], row["crawl_status"],
row["slave_node"], row["last_synced"],
row["checkpoint_time"],
row["checkpoint_completed"],
row["checkpoint_completion_time"]])
# If Table has data
if session[2]:
print table
else:
# When no filters match
print "-"
print ("Active: {active} | Passive: {passive} | "
"Faulty: {faulty} | Created: {created} | "
"Offline: {offline} | Stopped: {stopped} | "
"Initializing: {initializing} | "
"Total: {total}".format(**session[1]))
# Empty line in output
print
评论列表
文章目录