Skip to content
Snippets Groups Projects
Commit 8452b12c authored by Christoph Alt's avatar Christoph Alt
Browse files

added a distinction between units and axis label

parent b83336f9
No related branches found
No related tags found
No related merge requests found
Pipeline #47107 passed
from dataclasses import asdict, dataclass
from typing import List, Union
from grafanalib.core import (Annotations, Dashboard, GridPos, Panel, Repeat,
RowPanel, Stat, Template, Templating, Time,
TimeSeries, Threshold, DashboardList)
from grafanalib.core import (Annotations, Dashboard, DashboardList, GridPos,
Panel, Repeat, RowPanel, Stat, Template,
Templating, Threshold, Time, TimeSeries)
from grafanalib.influxdb import InfluxDBTarget
from dashboards.annotations import Annotation
......@@ -66,6 +66,7 @@ def build_row_repeat_dashboard(
measurment_name: str,
panel_query: Query,
unit: str,
axisLabel: str,
other_vars: List[Template] = [],
annotations: Annotations = Annotations(),
) -> Dashboard:
......@@ -81,7 +82,8 @@ def build_row_repeat_dashboard(
dataSource=dataSource,
targets=[get_influx_target(str(panel_query))],
repeat=Repeat('h', panel_repeat_var.name),
axisLabel=unit,
unit=unit,
axisLabel=axisLabel,
pointSize=9,
),
],
......
......@@ -3,14 +3,14 @@ from typing import List
from dashboards.dashboard_base import (DashboardOptions, build_dashboard,
build_row_repeat_dashboard,
get_commit_annotation,
get_dashboard_list,
get_dashboard_variable_query,
get_grid_pos, get_stat_panel,
pack_in_row,
get_dashboard_list)
pack_in_row)
from dashboards.influx_queries import (Query, get_variable_condition,
join_conditions, join_variable_and,
show_tag_values)
from dashboards.units import Units
from dashboards.legends import AxisLabel, Units
def _uniform_grid(arch: str, group_by: List[str]):
......@@ -18,7 +18,8 @@ def _uniform_grid(arch: str, group_by: List[str]):
measurment_name = f'UniformGrid{arch}'
row_repeat = "collisionSetup"
panel_repeat = "host"
unit = Units.mlups
unit = Units.number
axisLabel = AxisLabel.mlups
row_repeat_var = get_dashboard_variable_query(
row_repeat, show_tag_values(measurment_name, row_repeat), dataSource)
......@@ -43,9 +44,14 @@ def _uniform_grid(arch: str, group_by: List[str]):
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,
return build_row_repeat_dashboard(options,
row_repeat_var,
panel_repeat_var,
dataSource,
measurment_name,
query,
unit,
axisLabel,
[cellsPerBlock_var],
annotations=annotations)
......@@ -96,6 +102,7 @@ def dashboard_granular_gas():
row_repeat = "kernel"
panel_repeat = "host"
unit = Units.milliseconds
axisLabel = AxisLabel.runtime
row_repeat_var = get_dashboard_variable_query(
row_repeat, f"SHOW FIELD KEYS FROM {measurment_name}", dataSource)
......@@ -117,7 +124,7 @@ def dashboard_granular_gas():
measurment_name)
return build_row_repeat_dashboard(options, row_repeat_var,
panel_repeat_var, dataSource,
measurment_name, query, unit,
measurment_name, query, unit, axisLabel,
annotations=annotations)
......@@ -126,7 +133,8 @@ def dashboard_phasefieldallenchan():
measurment_name = 'PhaseFieldAllenCahn'
row_repeat = "cellsPerBlock_0"
panel_repeat = "host"
unit = Units.mlups
unit = Units.number
axisLabel = AxisLabel.mlups
options = DashboardOptions(
title='Phase Field Allen Chan',
......@@ -162,7 +170,7 @@ def dashboard_phasefieldallenchan():
measurment_name)
dashboard = build_row_repeat_dashboard(options, row_repeat_var,
panel_repeat_var, dataSource,
measurment_name, query, unit,
measurment_name, query, unit, axisLabel,
annotations=annotations)
dashboard.rows = [
pack_in_row("Power Consumption", panel_power), *dashboard.rows
......@@ -175,7 +183,8 @@ def dashboard_phasefieldallenchangpu():
measurment_name = 'PhaseFieldAllenCahnGPU'
row_repeat = "cellsPerBlock_0"
panel_repeat = "host"
unit = Units.mlups
unit = Units.number
axisLabel = AxisLabel.mlups
options = DashboardOptions(
title='Phase Field Allen Chan GPU',
......@@ -200,9 +209,14 @@ def dashboard_phasefieldallenchangpu():
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,
return build_row_repeat_dashboard(options,
row_repeat_var,
panel_repeat_var,
dataSource,
measurment_name,
query,
unit,
axisLabel,
annotations=annotations)
......
......@@ -2,6 +2,11 @@ from enum import Enum
class Units(str, Enum):
mlups = 'MLUPS per process'
seconds = 's'
milliseconds = 'ms'
number = 'none'
class AxisLabel(str, Enum):
mlups = 'MLUPS per process'
runtime = 'Runtime'
from grafanalib.core import (Dashboard, Repeat, RowPanel, Templating, Time,
TimeSeries)
from dashboards.dashboard_base import (get_dashboard_variable_query,
get_influx_target,
get_commit_annotation)
from dashboards.dashboard_base import (get_commit_annotation,
get_dashboard_variable_query,
get_influx_target)
from dashboards.dashboard_list import dashboard_uniformGridGPU
from dashboards.influx_queries import Query, show_tag_values
......@@ -63,6 +63,7 @@ dashboard = Dashboard(
get_influx_target(str(q1))
],
repeat=Repeat('h', host_var.name),
unit='none',
axisLabel='MLUPS per process',
pointSize=9,
),
......
from dashboards.units import Units
from dashboards.legends import AxisLabel, Units
def test_units():
assert Units.mlups == 'MLUPS per process'
assert Units.seconds == 's'
assert Units.milliseconds == 'ms'
def test_labels():
assert AxisLabel.mlups == 'MLUPS per process'
assert AxisLabel.runtime == 'Runtime'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment