def view_weather_arso(): form = BackPeriodForm() back_period = None if form.validate_on_submit(): print "Form OK 21" back_period = form.back_period.data print back_period back_period = back_period if back_period is not None else get_setting("ARSO_BACK_PLOT_PERIOD", int).value return render_template("weather_arso.html", form=form, page_loc="environment", back_period=back_period)
def view_server(): form = BackPeriodForm() back_period = None if form.validate_on_submit(): print "Form OK 22" back_period = form.back_period.data print back_period table_data = read_temp_log(get_files(), back_period=back_period if back_period is not None else get_setting("SERVER_TEMP_PLOT_BACK_PERIOD", int).value) temperature_chart_data = [[], [], [], []] load_chart_data = [[], [], [], []] all_date_time = [] for row in table_data: if row[0].startswith("Tim"): continue date_time = datetime.datetime.strptime(row[0], "%H:%M:%S %m/%d/%y") all_date_time.append(date_time) temperature_chart_data[0].append(float(row[1])) temperature_chart_data[1].append(float(row[2])) temperature_chart_data[2].append(float(row[3])) temperature_chart_data[3].append(float(row[4])) load_chart_data[0].append(float(row[5])) load_chart_data[1].append(float(row[6])) load_chart_data[2].append(float(row[7])) load_chart_data[3].append(float(row[8])) update_time = all_date_time[0] stat_data = [ { "name": "Core 0", "temp_mean": stats.mean(temperature_chart_data[0]), "temp_st_dev": stats.st_dev(temperature_chart_data[0]), "load_mean": stats.mean(load_chart_data[0]), "load_st_dev": stats.st_dev(load_chart_data[0]), "temperature_last_reading": temperature_chart_data[0][0] }, { "name": "Core 1", "temp_mean": stats.mean(temperature_chart_data[1]), "temp_st_dev": stats.st_dev(temperature_chart_data[1]), "load_mean": stats.mean(load_chart_data[1]), "load_st_dev": stats.st_dev(load_chart_data[1]), "temperature_last_reading": temperature_chart_data[1][0] }, { "name": "Core 2", "temp_mean": stats.mean(temperature_chart_data[2]), "temp_st_dev": stats.st_dev(temperature_chart_data[2]), "load_mean": stats.mean(load_chart_data[2]), "load_st_dev": stats.st_dev(load_chart_data[2]), "temperature_last_reading": temperature_chart_data[2][0] }, { "name": "Core 3", "temp_mean": stats.mean(temperature_chart_data[3]), "temp_st_dev": stats.st_dev(temperature_chart_data[3]), "load_mean": stats.mean(load_chart_data[3]), "load_st_dev": stats.st_dev(load_chart_data[3]), "temperature_last_reading": temperature_chart_data[3][0] }, ] proc_max_temp = get_setting("PROC_MAX_TEMP_LIMIT", float).value limits = {"proc_max_temp": proc_max_temp} print "lesko", limits # pprint(stat_data) return render_template("view_server.html", form=form, back_period=back_period, stat_data=stat_data, limits=limits, update_time=update_time, page_loc="server")