From e533992e2b088b4cac8d6053d230afff291c1c12 Mon Sep 17 00:00:00 2001
From: Christoph Alt <christoph.alt@fau.de>
Date: Tue, 21 Nov 2023 11:47:06 +0100
Subject: [PATCH] adding colors for different sweep groups for the gravity wave
 dashboard

---
 dashboards/dashboard_walberla.py | 8 ++++++++
 dashboards/overrides.py          | 4 ++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/dashboards/dashboard_walberla.py b/dashboards/dashboard_walberla.py
index ad5c075..b40c005 100644
--- a/dashboards/dashboard_walberla.py
+++ b/dashboards/dashboard_walberla.py
@@ -8,6 +8,7 @@ from dashboards.dashboard_base import (DashboardOptions,
 
 from dashboards.panels import PanelInfos, get_time_series_panel
 from dashboards.variables import get_dashboard_variable, Filter
+from dashboards.overrides import get_color_regex_override
 
 from dashboards.influx_queries import join_variable_and
 from dashboards.legends import Units
@@ -272,6 +273,12 @@ def dashboard_fslbmgravitywave():
 
     where = join_variable_and([f.name for f in filters])
     annotations = get_commit_annotation(data_source, "red", "commits", measurment_name)
+    groups = ["Communication", "Sweep", "MPI Barrier"]
+    colors = ["red", "green", "blue"]
+    overrides = [
+        get_color_regex_override(f".*{group}:.*", color, mode="fixed")
+        for group, color in zip(groups, colors)
+    ]
 
     panels = [
         get_time_series_panel(
@@ -296,6 +303,7 @@ def dashboard_fslbmgravitywave():
             fillOpacity=70,
             gradientMode="Opacity",
             tooltipMode="single",
+            overrides=overrides,
         ))
 
     panels.append(
diff --git a/dashboards/overrides.py b/dashboards/overrides.py
index d5d9755..2a4f319 100644
--- a/dashboards/overrides.py
+++ b/dashboards/overrides.py
@@ -1,4 +1,4 @@
-def get_color_regex_override(regex: str, color: str):
+def get_color_regex_override(regex: str, color: str, *, mode: str = "fixed"):
     return {
         "matcher": {
             "id": "byRegexp",
@@ -9,7 +9,7 @@ def get_color_regex_override(regex: str, color: str):
                 "id": "color",
                 "value": {
                     "fixedColor": color,
-                    "mode": "fixed"
+                    "mode": mode
                 }
             }
         ]
-- 
GitLab