[2.8] Add NVFlare CLI tutorial#4639
Conversation
Greptile SummaryThis PR replaces the old job-template-focused
Confidence Score: 5/5Safe to merge; changes are additive, well-tested, and consistent with existing codebase patterns. The logic changes are straightforward: a new structured error handler in cmd_job_stats, a ValueError guard replacing a silent division-by-zero in evaluate(), and synthetic-data flags in hello-pt. All three are covered by the accompanying unit tests. The notebook is tutorial content with no runtime logic that could affect production code paths. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant NB as Notebook Cell
participant CLI as nvflare CLI
participant srv as FL Server
participant job as job.py
NB->>job: python job.py --export --export-dir ... --enable_log_streaming --synthetic_data
Note over job: spec.py strips --export/--export-dir at import time
job->>job: define_parser() sees remaining args only
job->>job: recipe.execute(env) export mode
job-->>NB: SystemExit(0), job folder written
NB->>CLI: nvflare job submit -j JOB_FOLDER --submit-token TOKEN
CLI-->>NB: JSON status ok, job_id returned
NB->>CLI: nvflare job stats JOB_ID --site all
alt job still running
CLI-->>NB: JSON status ok, stats data
else job already completed
CLI-->>NB: JSON error JOB_NOT_RUNNING
NB->>NB: non-fatal timing message, continue
end
NB->>CLI: nvflare job wait JOB_ID --timeout 600
CLI->>srv: poll until terminal
srv-->>CLI: FINISHED_OK
CLI-->>NB: JSON status ok
NB->>CLI: nvflare job download JOB_ID --output-dir RESULT_DIR
CLI-->>NB: artifacts written
NB->>job: python job.py --export ... --num_rounds 20
job-->>NB: SystemExit(0), folder overwritten
NB->>CLI: nvflare job submit abort token
CLI-->>NB: ABORT_JOB_ID returned
NB->>CLI: nvflare job abort ABORT_JOB_ID --force
CLI->>srv: abort running job
NB->>CLI: nvflare job wait ABORT_JOB_ID
CLI-->>NB: terminal ABORTED
Reviews (3): Last reviewed commit: "[2.8] Use recipe export args in hello-pt..." | Re-trigger Greptile |
|
Addressed the latest review comments in commit d023456:
Verification:
|
|
/build |
|
Follow-up pushed in commit 5a66aee:
Verification:
|
|
/build |
nvidianz
left a comment
There was a problem hiding this comment.
The args are already inconsistent, not caused by this PR.
## Summary - Replace the old job CLI notebook with an end-to-end NVFlare CLI tutorial covering config, system, study, and job workflows. - Update hello-pt so the tutorial can export a runnable synthetic-data job with log streaming enabled. - Normalize job stats behavior when a job is no longer running and add focused coverage. ## Validation - pytest tests/unit_test/tool/job/job_stats_test.py - jq empty examples/tutorials/nvflare_cli.ipynb - verified source notebook has no outputs or execution counts
## What this does Cherry-picks the two recent 2.8 PRs onto main: - #4630: 2.8.0 release notes - #4639: NVFlare CLI tutorial replacement and related hello-pt/job stats updates ## Verification - python3 -m pytest tests/unit_test/tool/job/job_stats_test.py tests/unit_test/tool/job/job_abort_test.py tests/unit_test/examples/hello_pt_client_test.py -q: 18 passed - notebook no outputs/execution counts check - git diff --check upstream/main..HEAD - targeted black/isort/flake8 - ./runtest.sh -s --------- Co-authored-by: Yuan-Ting Hsieh (謝沅廷) <yuantingh@nvidia.com>
Summary
Validation