summaryrefslogtreecommitdiff
path: root/clusterman/commands/frontend.py
blob: bcd4ab7dd814c1ce250ee35b82e23a17576b9d6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import os, json
from clusterman.config import CONF




def info():
    nodes=None
    if os.path.exists(CONF.NODE_FILE):
        with open(CONF.NODE_FILE) as f:
            nodes=json.load(f)

    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))

    # Cache
    print("Last node scan: ",end="")
    if cache!=None and "last_scan" in CONF["cache"]:
        print(CONF["cache"]["last_scan"])