Skip to content

[2.8] Add warnings for missing study data mappings#4528

Merged
YuanTingHsieh merged 2 commits into
NVIDIA:2.8from
YuanTingHsieh:codex/warn-missing-study-data-mapping
May 7, 2026
Merged

[2.8] Add warnings for missing study data mappings#4528
YuanTingHsieh merged 2 commits into
NVIDIA:2.8from
YuanTingHsieh:codex/warn-missing-study-data-mapping

Conversation

@YuanTingHsieh
Copy link
Copy Markdown
Collaborator

What changed

  • Added warning-level diagnostics when study_data.yaml is missing, empty, missing the submitted study, or has an empty dataset entry.
  • Passed launcher loggers from Docker and K8s launchers into the shared study-data helper so operators see the warning in runtime logs.
  • Updated Docker/K8s design docs to clarify that missing mappings still skip data mounts, but now emit warnings.
  • Added focused unit coverage for the new warning paths.

Why

The 2.8 branch documents missing study-data mappings as skip-by-design behavior, but the previous implementation gave operators no visible signal when a study job launched without expected data mounts. This keeps the existing contract while making incomplete mappings diagnosable.

Validation

  • git diff --check
  • python3 -m compileall nvflare/app_opt/job_launcher/study_data.py nvflare/app_opt/job_launcher/docker_launcher.py nvflare/app_opt/job_launcher/k8s_launcher.py tests/unit_test/app_opt/job_launcher/study_data_test.py tests/unit_test/app_opt/job_launcher/docker_launcher_test.py tests/unit_test/app_opt/job_launcher/k8s_launcher_test.py
  • Lightweight smoke check for the new warning path

Full pytest was not run locally because this environment is missing test/runtime dependencies such as pytest, yaml, and msgpack.

@YuanTingHsieh YuanTingHsieh changed the title [codex] Add warnings for missing study data mappings [2.8] Add warnings for missing study data mappings May 6, 2026
@YuanTingHsieh YuanTingHsieh marked this pull request as ready for review May 6, 2026 20:17
Copilot AI review requested due to automatic review settings May 6, 2026 20:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the diagnosability of “no study data mounts” behavior in NVFlare’s Docker and K8s job launchers by emitting warning-level logs when study_data.yaml is missing/empty or lacks an entry for the requested study (while preserving the existing skip-mount behavior).

Changes:

  • Added optional logger support to the shared study-data loader/resolver and emitted warnings for missing/empty mappings and missing/empty study entries.
  • Wired Docker/K8s launchers to pass their launcher logger into the shared helper so warnings appear in runtime logs.
  • Updated design docs and added/updated unit tests to cover the new warning paths.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
nvflare/app_opt/job_launcher/study_data.py Adds warning diagnostics (gated by optional logger) for missing/empty study data mappings and missing/empty study entries.
nvflare/app_opt/job_launcher/docker_launcher.py Passes the launcher logger into study-data helper calls so warnings surface in Docker runtime logs.
nvflare/app_opt/job_launcher/k8s_launcher.py Passes the launcher logger into study-data helper calls so warnings surface in K8s runtime logs.
tests/unit_test/app_opt/job_launcher/study_data_test.py Adds focused unit tests asserting warnings are logged when a logger is supplied.
tests/unit_test/app_opt/job_launcher/docker_launcher_test.py Updates assertions to reflect logger propagation and verifies warning appears when study mapping is missing.
docs/design/job_launcher_and_job_handle.md Clarifies that missing study entries skip mounts and now log warnings.
docs/design/docker_job_launcher_design.md Clarifies that missing mappings/entries skip mounts and now log warnings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 6, 2026

Greptile Summary

This PR adds warning-level diagnostics to the study-data mount path so operators see an explicit log message when study_data.yaml is missing, empty, or lacks an entry for the submitted study, while keeping the existing skip-by-design behaviour intact.

  • study_data.py: Adds _log_warning helper and an optional logger parameter to load_study_data_file and resolve_study_dataset_mounts; an if study_data: guard in resolve_study_dataset_mounts prevents double-logging when the file is empty or absent (the empty-file warning is already emitted by load_study_data_file).
  • docker_launcher.py / k8s_launcher.py: Thread logger=self.logger through both call sites so warnings appear in runtime logs; the K8s caching path correctly emits the missing-file warning only once on first load.
  • Tests: Four new caplog unit tests cover all new warning branches; existing Docker and K8s integration tests gain caplog assertions to verify end-to-end warning propagation.

Confidence Score: 5/5

Safe to merge — changes are additive, touch only the logging path, and preserve all existing skip-by-design behaviour.

The change is purely additive: no control-flow alterations, no new failure modes, and no interface-breaking changes. The if study_data: guard correctly prevents double-logging and is documented via a docstring. All four new warning paths are covered by focused unit tests, and the Docker and K8s integration tests verify end-to-end warning propagation through caplog.

No files require special attention.

Important Files Changed

Filename Overview
nvflare/app_opt/job_launcher/study_data.py Adds _log_warning helper and optional logger parameter to both load_study_data_file and resolve_study_dataset_mounts; warnings are correctly gated (empty-dict guard prevents double-logging when file is empty/missing)
nvflare/app_opt/job_launcher/docker_launcher.py Threads logger=self.logger into both study-data helpers so Docker launcher warnings surface in runtime logs; no behavioural change beyond new log output
nvflare/app_opt/job_launcher/k8s_launcher.py Same logger threading as Docker launcher; cached study_data_pvc_dict path correctly emits the missing-file warning only on first load, with subsequent study lookups still warning when the dict is non-empty but missing the requested study
tests/unit_test/app_opt/job_launcher/study_data_test.py Adds four focused caplog tests covering all four new warning paths (missing file, empty file, missing study entry, empty study entry); assertions are specific and correct
tests/unit_test/app_opt/job_launcher/docker_launcher_test.py Updates call-site assertions to include logger=launcher.logger kwarg and adds a caplog assertion to test_launch_omits_data_mount_when_study_mapping_is_missing to verify the warning reaches the caller
tests/unit_test/app_opt/job_launcher/k8s_launcher_test.py Adds a caplog.at_level assertion to the existing K8s missing-study test, mirroring the Docker-side integration coverage
docs/design/docker_job_launcher_design.md Two doc sentences updated to note that missing mappings now log a warning; accurate and minimal
docs/design/job_launcher_and_job_handle.md Three doc sentences updated to reflect warning logging on missing study entries; consistent with implementation

Sequence Diagram

sequenceDiagram
    participant L as DockerJobLauncher / K8sJobLauncher
    participant SD as study_data.py
    participant Log as self.logger

    L->>SD: "load_study_data_file(path, logger=self.logger)"
    alt file not found
        SD->>Log: warning("file '%s' was not found…")
        SD-->>L: "{}"
    else file empty
        SD->>Log: warning("file '%s' has no study entries…")
        SD-->>L: "{}"
    else file valid
        SD-->>L: "{study: {dataset: {...}}}"
    end

    L->>SD: "resolve_study_dataset_mounts(study_data, study, path, logger=self.logger)"
    alt study_data non-empty AND study missing
        SD->>Log: warning("file '%s' has no entry for study '%s'…")
        SD-->>L: []
    else study present but datasets empty
        SD->>Log: warning("entry for study '%s' has no datasets…")
        SD-->>L: []
    else study_data empty (already warned above)
        SD-->>L: []
    else datasets found
        SD-->>L: [StudyDatasetMount, …]
    end
Loading

Reviews (4): Last reviewed commit: "Merge branch '2.8' into codex/warn-missi..." | Re-trigger Greptile

Comment thread tests/unit_test/app_opt/job_launcher/docker_launcher_test.py
Comment thread nvflare/app_opt/job_launcher/study_data.py
@YuanTingHsieh YuanTingHsieh force-pushed the codex/warn-missing-study-data-mapping branch 2 times, most recently from 880fee2 to 2bf59bd Compare May 6, 2026 20:40
pcnudde
pcnudde previously approved these changes May 6, 2026
Signed-off-by: YuanTingHsieh <yuantingh@nvidia.com>
@YuanTingHsieh YuanTingHsieh force-pushed the codex/warn-missing-study-data-mapping branch from 4d5f18d to 37c9527 Compare May 7, 2026 18:04
@YuanTingHsieh
Copy link
Copy Markdown
Collaborator Author

/build

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 7, 2026

Greptile encountered an error while reviewing this PR. Please reach out to support@greptile.com for assistance.

@YuanTingHsieh YuanTingHsieh merged commit 674a441 into NVIDIA:2.8 May 7, 2026
24 checks passed
@YuanTingHsieh YuanTingHsieh deleted the codex/warn-missing-study-data-mapping branch May 7, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants