summaryrefslogtreecommitdiff
path: root/clusterman/commands/frontend.py
diff options
context:
space:
mode:
Diffstat (limited to 'clusterman/commands/frontend.py')
-rw-r--r--clusterman/commands/frontend.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/clusterman/commands/frontend.py b/clusterman/commands/frontend.py
index f275827..4d7ecc4 100644
--- a/clusterman/commands/frontend.py
+++ b/clusterman/commands/frontend.py
@@ -1,28 +1,24 @@
import os, json, re
+from datetime import datetime
from clusterman.config import CONF
-from clusterman.commands.node import get_node_in_group
+import clusterman.commands.node as node
def info():
- nodes=None
- if os.path.exists(CONF.NODE_FILE):
- with open(CONF.NODE_FILE) as f:
- nodes=json.load(f)
-
+ nodes=node.get_node_list()
cache=None
if os.path.exists(CONF.CACHE_FILE):
with open(CONF.CACHE_FILE) as f:
cache=json.load(f)
# Node
- print("Node count: ",end="")
- print("NA") if nodes==None else print(len(nodes))
+ print("Node count: "+str(len(nodes)))
# Groups
print("Node groups: ",end="")
if len(CONF["cluster"]["groups"]) > 0:
content=list()
for group in CONF["cluster"]["groups"].keys():
- content.append("{}({})".format(group,len(get_node_in_group(group))))
+ content.append("{}({})".format(group,len(node.get_node_in_group(group))))
print(", ".join(content))
else:
print("NA")
@@ -31,7 +27,8 @@ def info():
# Cache
print("Last node scan: ",end="")
if cache!=None and "last_scan" in CONF["cache"]:
- print(CONF["cache"]["last_scan"])
+ dt=datetime.fromtimestamp(int(CONF["cache"]["last_scan"]), tz=None)
+ print(dt)
else:
print("NA")