diff --git a/dashboards/dashboard_base.py b/dashboards/dashboard_base.py index 0f758ff850eea2383a6c9af2074df0dea091523b..9be7461369e31efa2db9f358d5150e39710cda74 100644 --- a/dashboards/dashboard_base.py +++ b/dashboards/dashboard_base.py @@ -21,9 +21,9 @@ def get_annotation(*args, **kwargs): return Annotations([Annotation(*args, **kwargs).to_json_data()]) -def get_commit_annotation(datasource: str, name: str, color: str, measurment_name: str): +def get_commit_annotation(datasource: str, color: str, name: str, measurment_name: str): query = ("SELECT \"commit\" from " - f"( SELECT first(\"mlupsPerProcess\") FROM \"{measurment_name}\" " + f"( SELECT first(/./) FROM \"{measurment_name}\" " "WHERE host =~ /^$host$/ AND $timeFilter GROUP BY \"commit\" )") return get_annotation(datasource, color, name, query) @@ -56,6 +56,7 @@ def build_row_repeat_dashboard( panel_query: Query, unit: str, other_vars: List[Template] = [], + annotations: Annotations = Annotations(), ) -> Dashboard: """Build a Dashboard that takes one query and repeats that with 2 variables.""" dashboard = Dashboard( @@ -78,6 +79,7 @@ def build_row_repeat_dashboard( ], templating=Templating([panel_repeat_var, row_repeat_var, *other_vars]), time=Time('now-7d', 'now'), + annotations=annotations, ) return dashboard.auto_panel_ids() diff --git a/dashboards/dashboard_list.py b/dashboards/dashboard_list.py index abace5a62905cd60343d71d9a6546dd845fa82ff..868a92a937e4424e9f4088045a964fd893f3212b 100644 --- a/dashboards/dashboard_list.py +++ b/dashboards/dashboard_list.py @@ -39,10 +39,14 @@ def _uniform_grid(arch: str, group_by: List[str]): tags=[arch, 'benchmark', 'walberla', 'Uniform Grid'], timezone="browser", ) + + annotations = get_commit_annotation("InfluxDB-1", "red", "commits", + measurment_name) return build_row_repeat_dashboard(options, row_repeat_var, panel_repeat_var, dataSource, measurment_name, query, unit, - [cellsPerBlock_var]) + [cellsPerBlock_var], + annotations=annotations) def dashboard_uniformGridGPU(): @@ -107,9 +111,13 @@ def dashboard_granular_gas(): tags=['CPU', 'benchmark', 'walberla', 'Granular Gas'], timezone="browser", ) + + annotations = get_commit_annotation("InfluxDB-1", "red", "commits", + measurment_name) return build_row_repeat_dashboard(options, row_repeat_var, panel_repeat_var, dataSource, - measurment_name, query, unit) + measurment_name, query, unit, + annotations=annotations) def dashboard_phasefieldallenchan(): @@ -148,14 +156,16 @@ def dashboard_phasefieldallenchan(): power_query, repeat=panel_repeat_var, format='W') + + annotations = get_commit_annotation("InfluxDB-1", "red", "commits", + measurment_name) dashboard = build_row_repeat_dashboard(options, row_repeat_var, panel_repeat_var, dataSource, - measurment_name, query, unit) + measurment_name, query, unit, + annotations=annotations) dashboard.rows = [ pack_in_row("Power Consumption", panel_power), *dashboard.rows ] - dashboard.annotations = get_commit_annotation("InfluxDB-1", "red", "commits", - measurment_name) return dashboard.auto_panel_ids() @@ -186,10 +196,13 @@ def dashboard_phasefieldallenchangpu(): "mpi_num_processes", "host", "executable", "timeStepStrategy", "stencil_phase", "stencil_hydro" ]) + annotations = get_commit_annotation("InfluxDB-1", "red", "commits", + measurment_name) return build_row_repeat_dashboard(options, row_repeat_var, panel_repeat_var, dataSource, - measurment_name, query, unit) + measurment_name, query, unit, + annotations=annotations) def dashboard_general_infos(): diff --git a/tests/test_dashboard_creation.py b/tests/test_dashboard_creation.py index 93458cd4c1efdba0ee6b5c6f67df098a07e3e432..a0d40ffe16f59384d3b35d7508085a042b026d3e 100644 --- a/tests/test_dashboard_creation.py +++ b/tests/test_dashboard_creation.py @@ -2,7 +2,8 @@ from grafanalib.core import (Dashboard, Repeat, RowPanel, Templating, Time, TimeSeries) from dashboards.dashboard_base import (get_dashboard_variable_query, - get_influx_target) + get_influx_target, + get_commit_annotation) from dashboards.dashboard_list import dashboard_uniformGridGPU from dashboards.influx_queries import Query, show_tag_values @@ -71,7 +72,7 @@ dashboard = Dashboard( ], templating=Templating([host_var, collisionsetup_var, cellsPerBlock_var]), time=Time('now-7d', 'now'), - + annotations=get_commit_annotation(dataSource, "red", "commits", measurment_name), ).auto_panel_ids()