Export flare.get_task_name from nvflare.client#4854
Conversation
EX-1 (Wave 0) of the Client API Execution Modes program (see docs/design/client_api_execution_modes_plan.md on PR NVIDIA#4853). get_task_name exists in nvflare/client/api.py but was not exported from the package, so flare.get_task_name() did not work despite being part of the rank contract's control-API surface. Adds the export and a test pinning the public control-API surface. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Greptile SummaryThis PR adds the missing
Confidence Score: 5/5Safe to merge — the change is a single-line re-export of a function that already existed and worked in the api module. The change only adds one import line to the package's init.py, restoring the missing export. The function itself is unchanged. The new identity-check test validates all 10 control-API symbols and will catch any future regression in this area. No files require special attention. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant User as User Code
participant flare as nvflare.client (__init__.py)
participant api as nvflare.client.api
User->>flare: import nvflare.client as flare
flare->>api: from .api import get_task_name as get_task_name
User->>flare: flare.get_task_name()
flare->>api: delegates to api.get_task_name()
api-->>User: returns task name string
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant User as User Code
participant flare as nvflare.client (__init__.py)
participant api as nvflare.client.api
User->>flare: import nvflare.client as flare
flare->>api: from .api import get_task_name as get_task_name
User->>flare: flare.get_task_name()
flare->>api: delegates to api.get_task_name()
api-->>User: returns task name string
Reviews (3): Last reviewed commit: "Merge branch 'main' into yuantingh/clien..." | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
Exports get_task_name from the nvflare.client package so flare.get_task_name() works as part of the intended public Client API surface, and adds a regression test to ensure the control-API names remain bound to the canonical nvflare.client.api functions.
Changes:
- Re-export
get_task_namefromnvflare/client/__init__.py. - Add a unit test that asserts (by object identity) that the control-API names on
nvflare.clientresolve to the same objects asnvflare.client.api.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/unit_test/client/package_exports_test.py | Adds an identity-based regression test covering the control-API exports from nvflare.client. |
| nvflare/client/init.py | Re-exports get_task_name from nvflare.client.api to complete the expected package-level API surface. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4854 +/- ##
==========================================
+ Coverage 56.95% 56.97% +0.01%
==========================================
Files 969 969
Lines 92261 92262 +1
==========================================
+ Hits 52551 52564 +13
+ Misses 39710 39698 -12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What
Export
get_task_namefrom thenvflare.clientpackage. It exists innvflare/client/api.pybut was never re-exported, soflare.get_task_name()failed despite being part of the Client API control surface.Program context
Client API Execution Modes (2.9) — EX-1, Wave 0 of the plan.
Design:
docs/design/client_api_execution_modes.md§ "Client API Backends" / rank contract (which listsget_task_name()among the control-rank APIs)Plan:
docs/design/client_api_execution_modes_plan.md(PR #4853)Depends on: none · Unblocks: nothing directly (removes a latent gap the rank contract assumes).
Testing
New
package_exports_test.pyasserts, by identity (flare.X is api.X), that all 10 control-API names resolve to theapimodule functions — so a future refactor that rebinds a name to the wrong object fails CI. 10 pass; black/isort/flake8 clean.🤖 Generated with Claude Code