fix(core/federated): guard aggregation module lookup against None#566
fix(core/federated): guard aggregation module lookup against None#566g-k-s-03 wants to merge 2 commits into
Conversation
|
Welcome @g-k-s-03! It looks like this is your first PR to kubeedge/ianvs 🎉 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: g-k-s-03 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Code Review
This pull request introduces a safety check in the FederatedLearning class initialization to ensure that the required aggregation module is present, raising a ValueError if it is missing. The reviewer suggested extending this validation to also check if the aggregator instance itself is None (i.e., _aggregation[1] is None) to prevent a potential AttributeError later in the execution flow.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
self.module_instances.get() returns None when the aggregation block is missing from the algorithm YAML. Unpacking None immediately crashes with TypeError: cannot unpack non-iterable NoneType object Add a None guard that raises a descriptive ValueError pointing the user to the missing YAML entry before the unpack is attempted. Issue: 565 Signed-off-by: g-k-s-03 <govindsingh97704@gmail.com>
26bf3f1 to
a13def4
Compare
Signed-off-by: g-k-s-03 <govindsingh97704@gmail.com>
|
/assign @hsj576, @Poorunga, @MooreZheng can you review this when you get time |
Description
FederatedLearning.__init__()unpacks the result ofself.module_instances.get()directly without a None guard. When theuser's algorithm YAML omits the
aggregationblock,.get()returnsNoneand Python crashes with:TypeError: cannot unpack non-iterable NoneType object
This gives no hint about which module is missing or how to fix the YAML.
Fix
Added a None guard that raises a descriptive
ValueErrorpointing theuser to the missing YAML entry before the unpack is attempted.
File Changed
core/testcasecontroller/algorithm/paradigm/federated_learning/federated_learning.pyline 78Testing
The fix is a pure guard — no behavior change on the happy path where
aggregation module is present.
Fixes #565