Repository navigation
MTN deterministic co_filename for dynamic code pickling - #560
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #560 +/- ##
=======================================
Coverage 96.34% 96.35%
=======================================
Files 3 3
Lines 575 576 +1
Branches 121 121
=======================================
+ Hits 554 555 +1
Misses 11 11
Partials 10 10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ogrisel
left a comment
There was a problem hiding this comment.
No idea on how to debug the random failure but I found a typo...
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
|
The failure is deterministic and only happening on windows and on this branch (see #562 running from master and working). |
This reverts commit 2aff8f2.
|
@tomMoral the bug seems to have disappeared with a more recent version of CPython 3.14 (and after sync with |
|
Let me trigger the CI another time. |
ogrisel
left a comment
There was a problem hiding this comment.
Besides the following, LGTM.
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
|
Feel free to skip the new tests on pypy if they are too slow to run without triggering a timeout. |
|
Ok I skipped the tests on |
Summary: Pull Request resolved: #5398 cloudpickle 3.1.3 (cloudpipe/cloudpickle#560, "deterministic co_filename for dynamic code pickling") replaces `co_filename` with "<dynamic-code>" for every function pickled by value. The debugger names frames with `inspect.getmodulename(curframe.f_code.co_filename)` (pdb_wrapper.py), which is `None` for that filename, so frames in pickled-by-value code show as `None.<func>`. That fails `test_debug_with_pickle_by_value` in GitHub CI on main since 3.1.3 was released (last green run installed 3.1.2, failing runs 3.1.3), and also degrades debugging of user code pickled by value. Pin `cloudpickle<3.1.3` until the debugger no longer depends on `co_filename` of pickled-by-value code. `uv.lock` already resolves 3.1.1; only its recorded requirement changes. ___ landed-with-radar-review Differential Revision: D133032795 fbshipit-source-id: 5da396f6623e9446e3645901a7b2de6d7a5f305a
## Summary of Changes Pin the test dependency `cloudpickle==3.1.2` to restore coverage of serialized Dask jobs and subflows. Cloudpickle 3.1.3 replaces `co_filename` with `<dynamic-code>` when serializing code objects ([upstream change](cloudpipe/cloudpickle#560)), so coverage.py cannot attribute worker execution to the original source files. The tests still pass, but Codecov reports the six Dask decorator lines and eighteen Espresso phonon subflow lines as missed. The successful main run [44219904494](https://github.com/Quantum-Accelerators/quacc/actions/runs/44219904494) installed cloudpickle 3.1.2; the regressed run [44755338965](https://github.com/Quantum-Accelerators/quacc/actions/runs/44755338965) installed 3.1.3. Both used coverage.py 7.17.3, distributed 2026.8.0, and Python 3.14.10, and both passed all 24 Dask tests. The pin is confined to the shared test requirements, with a comment explaining why it exists. Runtime dependency requirements and coverage exclusions are unchanged. ### Validation On Python 3.14.10 with `COVERAGE_CORE=sysmon`, coverage.py 7.17.3, and Dask/distributed 2026.8.0: - `tests/dask/test_syntax.py tests/dask/test_customizers.py`: 7 passed with both cloudpickle 3.1.2 and 3.1.3. - Coverage XML records hits on decorators.py lines 157–158 and 546–549 with 3.1.2; all six lines have zero hits with 3.1.3. - Expanded validation with cloudpickle 3.1.2: `tests/dask/test_syntax.py tests/dask/test_customizers.py tests/dask/test_tutorials.py tests/dask/test_copy_files.py`: 13 passed; all six decorator lines have hits in the resulting coverage XML. - `git diff --check` passes. Full Quantum ESPRESSO validation is left to CI because its external executables are not installed locally. ### Requirements - [x] My PR is focused on a single bugfix. - [x] Relevant existing tests were run to reproduce and validate the dependency regression. - [x] My PR is on a custom branch.
Set the
co_filenameto<dynamic-code>when pickling the code object to make the payload independent of where the code was defined.TODO:
Fix #538