From 3c02f64e789ea84bc790ce49ca6e21ec8b526790 Mon Sep 17 00:00:00 2001 From: Christian Heider Nielsen Date: Mon, 27 May 2024 12:34:03 +0200 Subject: [PATCH] as dict --- heimdallr/configuration/heimdallr_config.py | 4 ++-- heimdallr/entry_points/server.py | 24 ++++++++++----------- requirements/requirements_server.txt | 3 ++- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/heimdallr/configuration/heimdallr_config.py b/heimdallr/configuration/heimdallr_config.py index c54f30a..d3c8c5c 100644 --- a/heimdallr/configuration/heimdallr_config.py +++ b/heimdallr/configuration/heimdallr_config.py @@ -52,9 +52,9 @@ vision="https://travis-ci.com/aivclab/vision.svg?branch=master", RayKarsten="https://github.com/aivclab/RayKarstenWebAsm.svg", dmr="https://github.com/aivclab/dmr.svg", -) +).as_dict() BUILD_STATUS_INTERVAL = "build-status-interval" DEBUG = True -ALL_CONSTANTS = NOD(locals()) +ALL_CONSTANTS = NOD(locals()).as_dict() diff --git a/heimdallr/entry_points/server.py b/heimdallr/entry_points/server.py index b17014b..554f312 100644 --- a/heimdallr/entry_points/server.py +++ b/heimdallr/entry_points/server.py @@ -7,7 +7,6 @@ Created on 19/03/2020 """ - import copy import datetime import json @@ -23,6 +22,14 @@ from dash.html import Div from draugr.writers import LogWriter, MockWriter, Writer from flask import Response +from paho import mqtt +from paho.mqtt.client import Client +from paho.mqtt.enums import CallbackAPIVersion +from pandas import DataFrame +from waitress import serve +from warg import NOD, default_datetime_repr, ensure_existence + +from heimdallr import PROJECT_APP_PATH, PROJECT_NAME from heimdallr.configuration.heimdallr_config import ALL_CONSTANTS from heimdallr.configuration.heimdallr_settings import ( HeimdallrSettings, @@ -34,14 +41,6 @@ per_machine_per_device_pie_charts, to_overall_gpu_process_df, ) -from paho import mqtt -from paho.mqtt.client import Client -from pandas import DataFrame -from waitress import serve -from warg import NOD, default_datetime_repr -from warg import ensure_existence - -from heimdallr import PROJECT_APP_PATH, PROJECT_NAME __all__ = ["main"] @@ -81,7 +80,8 @@ HOSTNAME = socket.gethostname() CLIENT_ID = HOSTNAME MQTT_CLIENT = Client( - client_id=CLIENT_ID, + CallbackAPIVersion.VERSION1, + CLIENT_ID, # clean_session=True ) DASH_APP = Dash( @@ -175,7 +175,7 @@ def update_graph(n: int) -> Div: compute_machines = [] if GPU_STATS: compute_machines.extend( - per_machine_per_device_pie_charts(copy.deepcopy(GPU_STATS), KEEP_ALIVE) + per_machine_per_device_pie_charts(GPU_STATS.as_dict(), KEEP_ALIVE.as_dict()) ) return Div(compute_machines) @@ -226,7 +226,7 @@ def update_table(n: int) -> Div: compute_machines = [] if DU_STATS: - df = to_overall_du_process_df(copy.deepcopy(DU_STATS)) + df = to_overall_du_process_df(DU_STATS.as_dict()) else: df = DataFrame(["No data"], columns=("data",)) diff --git a/requirements/requirements_server.txt b/requirements/requirements_server.txt index 41a74c3..31eef7e 100644 --- a/requirements/requirements_server.txt +++ b/requirements/requirements_server.txt @@ -22,4 +22,5 @@ PyGithub msal pillow>=10.0.1 # not directly required, pinned by Snyk to avoid a vulnerability requests>=2.32.0 # not directly required, pinned by Snyk to avoid a vulnerability -wheel>=0.38.0 # not directly required, pinned by Snyk to avoid a vulnerability \ No newline at end of file +wheel>=0.38.0 # not directly required, pinned by Snyk to avoid a vulnerability +waitress \ No newline at end of file