Skip to content

Simplify code in ModelManager class#442

Merged
RemiLehe merged 4 commits into
BLAST-AI-ML:mainfrom
EZoni:amsc_logo_url
Jun 16, 2026
Merged

Simplify code in ModelManager class#442
RemiLehe merged 4 commits into
BLAST-AI-ML:mainfrom
EZoni:amsc_logo_url

Conversation

@EZoni

@EZoni EZoni commented May 8, 2026

Copy link
Copy Markdown
Member

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
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.

@EZoni EZoni requested a review from RemiLehe May 8, 2026 21:14
Comment thread dashboard/model_manager.py
Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com>
@RemiLehe

Copy link
Copy Markdown
Contributor

Thanks for this PR! Would you be able to fix the merge conflict?

@EZoni

EZoni commented Jun 11, 2026

Copy link
Copy Markdown
Member Author

New diff without whitespace after merging main:

diff --git a/dashboard/model_manager.py b/dashboard/model_manager.py
index 2145a5c..734de0f 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,9 +493,7 @@ class ModelManager:
             ):
                 with vuetify.VExpansionPanelText():
                     with vuetify.VRow(align="center"):
-                        with vuetify.VCol(
-                            cols=model_type_cols, classes="d-flex align-center"
-                        ):
+                        with vuetify.VCol(cols=8, classes="d-flex align-center"):
                             vuetify.VSelect(
                                 v_model=("model_type_verbose",),
                                 label="Model type",
@@ -508,7 +501,6 @@ class ModelManager:
                                 dense=True,
                                 hide_details=True,
                             )
-                        if AMSC_LOGO_URL:
                         with vuetify.VCol(
                             cols=4,
                             classes="d-flex align-center",
@@ -544,8 +536,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(
@@ -554,7 +545,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 commented Jun 11, 2026

Copy link
Copy Markdown
Member Author

@RemiLehe

Thank you, I merged main and fixed the conflict.

@RemiLehe RemiLehe merged commit 3536c9b into BLAST-AI-ML:main Jun 16, 2026
3 checks passed
@EZoni EZoni deleted the amsc_logo_url branch June 16, 2026 19:58
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