Skip to content

Commit 88a915d

Browse files
feat: remove Job ID line from HTML report when N/A (#350)
<!-- SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. --> <!-- SPDX-License-Identifier: Apache-2.0 --> <!-- Thank you for contributing to Safe Synthesizer! --> # Summary Removing Job ID line from the HTML evaluation report when it does not exist. This is the case for library jobs. ## Pre-Review Checklist <!-- These checks should be completed before a PR is reviewed, --> <!-- but you can submit a draft early to indicate that the issue is being worked on. --> Ensure that the following pass: - [x] `make format && make check` or via prek validation. - [x] `make test` passes locally - [x] `make test-e2e` passes locally - [ ] `make test-ci-container` passes locally (recommended) - [ ] GPU CI status check passes -- comment `/sync` on this PR to trigger a run (auto-triggers on ready-for-review) ## Pre-Merge Checklist <!-- These checks need to be completed before a PR is merged, --> <!-- but as PRs often change significantly during review, --> <!-- it's OK for them to be incomplete when review is first requested. --> - [ ] New or updated tests for any fix or new behavior - [ ] Updated documentation for new features and behaviors, including docstrings for API docs. ## Other Notes <!-- Please add the issue number that should be closed when this PR is merged. --> - Closes #<issue> --------- Signed-off-by: Alexa Haushalter <ahaushalter@nvidia.com>
1 parent eeb7367 commit 88a915d

3 files changed

Lines changed: 28 additions & 2 deletions

File tree

src/nemo_safe_synthesizer/evaluation/assets/jinja/reports/multi_modal_report.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,12 @@
8383
<section class="main">
8484
<section class="overview" id="overview">
8585
<h1>Overview</h1>
86+
{% if ctx.job_id %}
8687
<div>
8788
<div class="field">Job ID</div>
8889
<div class="text">{{ ctx.job_id }}</div>
8990
</div>
91+
{% endif %}
9092
<div>
9193
<div class="field">Generated</div>
9294
<div class="text">{{ now.strftime("%m/%d/%Y") }}</div>

src/nemo_safe_synthesizer/evaluation/reports/multimodal/multimodal_report.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ def jinja_context(self):
7070
try:
7171
ctx = super().jinja_context
7272
ctx["tooltips"] = tooltips
73-
# Get the job ID if it exist or create a new one.
74-
ctx["job_id"] = os.environ.get("NEMO_JOB_ID") or "N/A"
73+
# Job ID from the runtime environment (e.g. cluster); omit from HTML when unset.
74+
raw_job_id = os.environ.get("NEMO_JOB_ID")
75+
ctx["job_id"] = (raw_job_id or "").strip() or None
7576

7677
# Shorthands used in template
7778
ctx["with_synthesizer"] = False

tests/evaluation/reports/test_multimodal_report.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4+
import pandas as pd
45
import pytest
56

67
# Skip all tests in this module if sentence_transformers is not available
@@ -9,10 +10,32 @@
910
reason="sentence_transformers is required for these tests (install with: uv sync --extra cpu)",
1011
)
1112

13+
from nemo_safe_synthesizer.evaluation.data_model.evaluation_dataset import EvaluationDataset
1214
from nemo_safe_synthesizer.evaluation.data_model.evaluation_score import Grade
1315
from nemo_safe_synthesizer.evaluation.reports.multimodal.multimodal_report import MultimodalReport
1416

1517

18+
def _minimal_multimodal_report() -> MultimodalReport:
19+
reference = pd.DataFrame({"x": [1, 2], "y": [3, 4]})
20+
output = pd.DataFrame({"x": [1, 2], "y": [3, 4]})
21+
dataset = EvaluationDataset(reference=reference, output=output)
22+
return MultimodalReport(evaluation_dataset=dataset, components=[])
23+
24+
25+
def test_jinja_context_job_id_none_when_nemo_job_id_unset(monkeypatch: pytest.MonkeyPatch) -> None:
26+
monkeypatch.delenv("NEMO_JOB_ID", raising=False)
27+
report = _minimal_multimodal_report()
28+
ctx = report.jinja_context
29+
assert ctx["job_id"] is None
30+
31+
32+
def test_jinja_context_job_id_set_when_nemo_job_id_present(monkeypatch: pytest.MonkeyPatch) -> None:
33+
monkeypatch.setenv("NEMO_JOB_ID", "cluster-job-abc123")
34+
report = _minimal_multimodal_report()
35+
ctx = report.jinja_context
36+
assert ctx["job_id"] == "cluster-job-abc123"
37+
38+
1639
@pytest.mark.skip(reason="Times out")
1740
def test_multimodal_report(train_df_5k, synth_df_5k, test_df, skip_privacy_metrics_config):
1841
report = MultimodalReport.from_dataframes(

0 commit comments

Comments
 (0)