Merge branch 'macgeek_issue10' into 'dev'

WSL Fix, issue 10

See merge request crafty-controller/crafty-commander!17
This commit is contained in:
Phillip Tarrant 2021-01-14 14:56:51 +00:00
commit 30b65d0d48
2 changed files with 7 additions and 3 deletions

View File

@ -19,12 +19,16 @@ class Stats:
def get_node_stats(self):
boot_time = datetime.datetime.fromtimestamp(psutil.boot_time())
data = {}
try:
cpu_freq = psutil.cpu_freq()
except NotImplementedError:
cpu_freq = psutil._common.scpufreq(current=0, min=0, max=0)
node_stats = {
'boot_time': str(boot_time),
'cpu_usage': psutil.cpu_percent(interval=0.5) / psutil.cpu_count(),
'cpu_count': psutil.cpu_count(),
'cpu_cur_freq': round(psutil.cpu_freq()[0], 2),
'cpu_max_freq': psutil.cpu_freq()[2],
'cpu_cur_freq': round(cpu_freq[0], 2),
'cpu_max_freq': cpu_freq[2],
'mem_percent': psutil.virtual_memory()[2],
'mem_usage': helper.human_readable_file_size(psutil.virtual_memory()[3]),
'mem_total': helper.human_readable_file_size(psutil.virtual_memory()[0]),

View File

@ -62,7 +62,7 @@ class Helpers:
else:
return False
logger.error("{} does not exits".format(file))
return False
return True
def get_setting(self, key, default_return=False):