Repository navigation
fix(npu): resolve connector classes through getattr in the factory - #567
Conversation
|
The factory change looks good. Could we fold the lazy-export regression case into the existing factory coverage in I'd drop the missing-name case. The old dictionary lookup raised |
|
Thanks for the review. I'll move the lazy-export regression case into |
f7bca2e to
7e4323e
Compare
The CAMP2P package resolves its public names lazily, so the class is not in the module dictionary and the factory's vars(module) lookup raises KeyError for CAMP2pAFDConnector at worker start. getattr follows the package __getattr__ hook and keeps eager modules working the same way. The regression case lives with the other P2P factory tests and registers into a copied registry, so the temporary entry does not outlive the test. Signed-off-by: 宋元盟 <songyuanmeng2@huawei.com>
7e4323e to
82ef9ca
Compare
|
This restores CAMP2P startup on Scope: Checks at The test-side guards (async FFN |
What this fixes
camp2presolves its public names through a package-level__getattr__(#503). The connector factory still read the class out of the module dictionary:For a lazily exported class that dictionary is empty, so every CAMP2P start fails before the worker can build the connector:
Change
Read the class with
getattr, which follows the__getattr__hook and behaves exactly as before for eagerly exported modules.The regression case moved into
tests/unit/connectors/test_p2p_connector.pywith the other factory tests: it registers a temporary connector backed by a module that only answers through__getattr__, and registers into a copied_registryso the temporary entry does not outlive the test. The missing-name case was dropped; the standalone test file is gone.Validation
vars()lookup.tests/unit/connectors/test_p2p_connector.pyand the maintained CPU suite pass.