Skip to content

Simplify code in ModelManager class#442

Open
EZoni wants to merge 2 commits into
BLAST-AI-ML:mainfrom
EZoni:amsc_logo_url
Open

Simplify code in ModelManager class#442
EZoni wants to merge 2 commits into
BLAST-AI-ML:mainfrom
EZoni:amsc_logo_url

Conversation

@EZoni
Copy link
Copy Markdown
Member

@EZoni EZoni commented May 8, 2026

Overview

Minor code changes extracted from #439.

Merge first

Diff without whitespace

diff --git a/dashboard/model_manager.py b/dashboard/model_manager.py
index b7fc08f..1ad8d98 100644
--- a/dashboard/model_manager.py
+++ b/dashboard/model_manager.py
@@ -27,11 +27,7 @@ MODEL_TYPE_GP = "Gaussian Process"
 MODEL_TYPE_NN_SINGLE = "Neural Network (single)"
 MODEL_TYPE_NN_ENSEMBLE = "Neural Network (ensemble)"
 AMSC_LOGO_PATH = LOGO_DIR / "AmSC_300px.png"
-AMSC_LOGO_URL = (
-    LocalFileManager(LOGO_DIR).url("amsc_logo", AMSC_LOGO_PATH)
-    if AMSC_LOGO_PATH.is_file()
-    else None
-)
+AMSC_LOGO_URL = LocalFileManager(LOGO_DIR).url("amsc_logo", AMSC_LOGO_PATH)
 MODEL_DOWNLOAD_ACTIVE_EXPR = "model_downloading"
 AMSC_MLFLOW_LINK_ACTIVE_EXPR = (
     f"model_available && model_mlflow_tracking_uri === '{AMSC_MLFLOW_URL}'"
@@ -490,7 +486,6 @@ class ModelManager:
             MODEL_TYPE_NN_SINGLE,
             MODEL_TYPE_NN_ENSEMBLE,
         ]
-        model_type_cols = 8 if AMSC_LOGO_URL else 12
         with vuetify.VExpansionPanels(v_model=("expand_panel_control_model", 0)):
             with vuetify.VExpansionPanel(
                 title="Control: Models",
@@ -498,14 +493,13 @@ class ModelManager:
             ):
                 with vuetify.VExpansionPanelText():
                     with vuetify.VRow(align="center"):
-                        with vuetify.VCol(cols=model_type_cols):
+                        with vuetify.VCol(cols=8):
                             vuetify.VSelect(
                                 v_model=("model_type_verbose",),
                                 label="Model type",
                                 items=(model_type_list,),
                                 dense=True,
                             )
-                        if AMSC_LOGO_URL:
                         with vuetify.VCol(
                             cols=4,
                             classes="d-flex align-center justify-end",
@@ -541,8 +535,7 @@ class ModelManager:
                                     "Selected model is not available in AmSC MLflow"
                                 ),
                                 style=(
-                                        "width: 100%; max-width: 300px; "
-                                        "margin-left: auto;"
+                                    "width: 100%; max-width: 300px; margin-left: auto;"
                                 ),
                             )
                     with vuetify.VRow(
@@ -551,7 +544,7 @@ class ModelManager:
                         align="center",
                         style="margin-top: -8px; margin-bottom: 8px;",
                     ):
-                        with vuetify.VCol(cols=model_type_cols):
+                        with vuetify.VCol():
                             with html.Div(
                                 classes=(
                                     "d-flex align-center text-caption "

@EZoni EZoni added dashboard Changes related to the dashboard cleaning Changes related to code cleaning labels May 8, 2026
if AMSC_LOGO_PATH.is_file()
else None
)
AMSC_LOGO_URL = LocalFileManager(LOGO_DIR).url("amsc_logo", AMSC_LOGO_PATH)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The AmSC logo is shipped with the repository and is always available at dashboard/logos/AmSC_300px.png.

Comment thread dashboard/model_manager.py Outdated
style="margin-top: -8px; margin-bottom: 8px;",
):
with vuetify.VCol(cols=model_type_cols):
with vuetify.VCol():
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The model download progress bar, which is displayed in its own empty row, now spans the entire width of the card, from the left side of the model type selector to the right side of the AmSC logo.

"Selected model is not available in AmSC MLflow"
),
style=(
"width: 100%; max-width: 300px; margin-left: auto;"
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This style changed (all specs on one line) was enforced by Ruff through pre-commit.

Comment thread dashboard/model_manager.py Outdated
Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleaning Changes related to code cleaning dashboard Changes related to the dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants