Skip to content

Commit

Permalink
Disable TUI from main invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
EdmundGoodman committed Feb 18, 2024
1 parent 67b5637 commit fa7b65c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
5 changes: 2 additions & 3 deletions src/hpc_multibench/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from enum import Enum, auto
from pathlib import Path

from hpc_multibench.tui.user_interface import UserInterface
# from hpc_multibench.tui.user_interface import UserInterface
from hpc_multibench.yaml_model import TestPlan


Expand All @@ -21,8 +21,7 @@ def main(yaml_path: Path, mode: Mode = Mode.RUN) -> None: # pragma: no cover
"""Run the tool."""
test_plan = TestPlan.from_yaml(yaml_path)

UserInterface(test_plan).run()
return
# UserInterface(test_plan).run()

if mode in (Mode.RUN, Mode.ALL):
test_plan.run()
Expand Down
16 changes: 12 additions & 4 deletions src/hpc_multibench/tui/user_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,27 @@ def on_mount(self) -> None:
tree = self.query_one(TestPlanTree)
tree.populate()

plt = self.query_one(RunAnalysisPlot).plt
plt = self.query_one("#metrics_plot", RunAnalysisPlot).plt
plt.title("Scatter Plot")
plt.scatter(plt.sin())
plt.plot(plt.sin())

def handle_tree_selection(self, node: TreeNode[TestPlanTreeType]) -> None:
"""."""
info_box = self.app.query_one("#information-box", Static)
metrics_table = self.app.query_one("#metrics-table", DataTable)
metrics_plot = self.query_one("#metrics_plot", RunAnalysisPlot).plt

output_string = f"{type(node.data)} {node.label}"
if isinstance(node.data, BenchModel):
# Run tab
output_string = "\n".join([str(x) for x in node.data.matrix_iterator])
# Metrics tab
metrics_table.add_columns(*node.data.analysis.metrics.keys())
for results in node.data.get_analysis(str(node.label)):
metrics_table.add_row(*[str(x) for x in results.values()])
# Plot tab
metrics_plot.title("Run time / Mesh width")
metrics_plot.plot([100, 200, 300], [100, 200, 300])
else:
# TODO: Could be a text area
output_string = node.data.realise("", str(node.label), {}).sbatch_contents

info_box.update(output_string)

0 comments on commit fa7b65c

Please sign in to comment.