Skip to content

Commit

Permalink
MAINT: PR 839 revisions
Browse files Browse the repository at this point in the history
* the bandwidth text in the Python summary report is now
colored "blue," along with a regression test, based on
reviewer feedback

* added `skew-app.darshan` log to
`test_derived_metrics_bytes_and_bandwidth()`--we get the same
results as `darshan-parser`

* replaced the `xfail` for `e3sm_io_heatmap_only.darshan` with
an expected `KeyError` when handling `APMPI` (this should already
be handled gracefully/ignored by the Python summary report)
  • Loading branch information
tylerjereddy committed Nov 30, 2022
1 parent 8f6676f commit b2e8218
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
3 changes: 2 additions & 1 deletion darshan-util/pydarshan/darshan/cli/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ <h3>${fig_title}</h3>
<figcaption>${fig.fig_description}</figcaption>
% else:
<!-- temporary handling for DXT-disabled cases -->
<figcaption style="font-weight: bold; color: red; width: 400px;">
<!-- now also handles the bandwidth text... -->
<figcaption style="font-weight: bold; color: ${fig.text_only_color}; width: 400px;">
${fig.fig_description}
</figcaption>
% endif
Expand Down
12 changes: 11 additions & 1 deletion darshan-util/pydarshan/darshan/cli/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ def __init__(
fig_args: dict,
fig_description: str = "",
fig_width: int = 500,
# when there is no HTML data generated
# for the figure (i.e., no image/plot),
# we have the option of changing the caption
# text color for a warning/important standalone text
text_only_color: str = "red",
):
self.section_title = section_title
if not fig_title:
Expand All @@ -69,7 +74,11 @@ def __init__(
# temporary handling for DXT disabled cases
# so special error message can be passed
# in place of an encoded image
# NOTE: this code path is now also
# being used for adding the bandwidth
# text, which doesn't really have an image...
self.fig_html = None
self.text_only_color = text_only_color
if self.fig_func:
self.generate_fig()

Expand Down Expand Up @@ -499,7 +508,8 @@ def register_figures(self):
fig_func=None,
fig_args=None,
fig_description=log_get_bytes_bandwidth(log_path=self.log_path,
mod_name=mod))
mod_name=mod),
text_only_color="blue")
self.figures.append(bandwidth_fig)
except (RuntimeError, KeyError):
# the module probably doesn't support derived metrics
Expand Down
15 changes: 12 additions & 3 deletions darshan-util/pydarshan/darshan/tests/test_cffi_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,15 @@ def test_log_get_generic_record(dtype):
# TODO: determine if the lack of APMPI and
# any other "add-ons" in _structdefs is a bug
# in the control flow for `log_get_derived_metrics()`?
pytest.param("e3sm_io_heatmap_only.darshan",
("e3sm_io_heatmap_only.darshan",
"APMPI",
"",
marks=pytest.mark.xfail(reason="APMPI and derived metrics control flow?")),
"KeyError"),
("skew-app.darshan",
"POSIX",
"I/O performance estimate (at the POSIX layer): transferred 41615.8 MiB at 157.49 MiB/s"),
("skew-app.darshan",
"MPI-IO",
"I/O performance estimate (at the MPI-IO layer): transferred 41615.8 MiB at 55.22 MiB/s"),
])
def test_derived_metrics_bytes_and_bandwidth(log_path, mod_name, expected_str):
# test the basic scenario of retrieving
Expand All @@ -235,6 +240,10 @@ def test_derived_metrics_bytes_and_bandwidth(log_path, mod_name, expected_str):
match=f"{mod_name} is not in the available log"):
backend.log_get_bytes_bandwidth(log_path=log_path,
mod_name=mod_name)
elif expected_str == "KeyError":
with pytest.raises(KeyError, match=f"{mod_name}"):
backend.log_get_bytes_bandwidth(log_path=log_path,
mod_name=mod_name)
else:
actual_str = backend.log_get_bytes_bandwidth(log_path=log_path,
mod_name=mod_name)
Expand Down
1 change: 1 addition & 0 deletions darshan-util/pydarshan/darshan/tests/test_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ def test_main_all_logs_repo_files(tmpdir, log_filepath):
# (more detailed per-module probes are present
# in test_derived_metrics_bytes_and_bandwidth())
assert "I/O performance estimate" in report_str
assert "color: blue" in report_str


class TestReportData:
Expand Down

0 comments on commit b2e8218

Please sign in to comment.