Commit 8eb40f83 authored by lu.xu's avatar lu.xu

software/ors-amarisoft: fixup check_cpu_temperature

parent 15569ea9
...@@ -79,7 +79,7 @@ class RunPromise(GenericPromise): ...@@ -79,7 +79,7 @@ class RunPromise(GenericPromise):
data = psutil.sensors_temperatures() data = psutil.sensors_temperatures()
cpu_temp = data['coretemp'][0][1] cpu_temp = data['coretemp'][0][1]
l = get_data_interval(self.__log_file, max_avg_temp_duration) l = get_data_interval(self.__log_file, max_avg_temp_duration) or [{'cpu_temperature': cpu_temp}]
avg_temp = sum(map(lambda x: x['cpu_temperature'], l)) / len(l) avg_temp = sum(map(lambda x: x['cpu_temperature'], l)) / len(l)
data = json.dumps({'cpu_temperature': cpu_temp, 'avg_cpu_temperature': avg_temp}) data = json.dumps({'cpu_temperature': cpu_temp, 'avg_cpu_temperature': avg_temp})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment