Repository navigation
test(looper): drop wrapper lambdas flagged by code quality (#4182) - #4246
Merged
Merged
Conversation
Pass the callable directly instead of a one-line lambda when mocking as_completed. Keep the deliberate BaseException drain in the worker-result loops: it mirrors stage_subset._collect_worker_results and ensures every submitted future is resolved before the first failure propagates, including control-flow exceptions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #4242 (issue #4182).
#4242 squash-merged at
23bbc0ba0while the code-quality follow-up was being pushed, so the two wrapper-lambda fixes did not land inmain. This PR carries only that test cleanup.Changes
tests/test_weight_only_looper.py: passlistdirectly to theas_completedmonkeypatch instead oflambda mapping: list(mapping)in both drain tests. Same behavior, no wrapper.Deliberately not changed
The three
except BaseExceptionfindings stay as-is. Those loops drain every already-submitted future before propagating the first failure and mirrorstage_subset._collect_worker_results(_WORKER_FAILURES = (BaseException,)). Narrowing toExceptionwould letKeyboardInterrupt/SystemExitskip the drain and abandon sibling futures, which is the leak the change fixes. Each thread on #4242 has a reply explaining this and is resolved.Validation
ruff check gptqmodel docs/eora tests setup.py-> All checks passedpytest tests/test_weight_only_looper.py::test_weight_only_quantize_subset_drains_workers_after_a_failure tests/test_weight_only_looper.py::test_weight_only_finalize_subset_drains_workers_after_a_failure -q-> 2 passedHardware: CPU only.