fix: handle race condition in daily warning v0.x#2546
fix: handle race condition in daily warning v0.x#2546player3zxcvbnm wants to merge 6 commits intoarviz-devs:v0.xfrom
Conversation
|
Changes: Encoding: Added encoding='utf-8' to file reads/writes. CI Failures: Let me know if there's anything else I should adjust on my end. |
OriolAbril
left a comment
There was a problem hiding this comment.
@Zethson or @schmoelder would either of you be able to test this PR? If it works I can make a patch release.
The version comment will need fixing before merging, but the other two can be ignored if the PR already fixes the issue.
| # pylint: disable=wildcard-import,invalid-name,wrong-import-position | ||
| """ArviZ is a library for exploratory analysis of Bayesian models.""" | ||
| __version__ = "0.23.4" | ||
| __version__ = "0.23.3" |
| _atomic_write_text(stamp_file, today.isoformat()) | ||
| try: | ||
| # Use a 'lock' file with today's date to ensure only one process warns | ||
| lock_file = stamp_file.with_suffix(f".{today}.lock") |
There was a problem hiding this comment.
I am not sure accumulating these lockfiles over time is a very good idea. We don't want the warning to be too overbearing but if it shows multiple times when importing arviz in parallel it would be perfectly fine too. If it works it might be fine though, this is a backport fix on a frozen version so no need to overthink it too much
Co-authored-by: Oriol Abril-Pla <oriol.abril.pla@gmail.com>
|
Applied the suggestion for the lockfile and bumped the version to 0.23.4. Ready for testing! My apologies for the repo confusion earlier—I'm still getting oriented with the ArviZ ecosystem. |
Hi
I’ve implemented a fix for the race condition in _warn_once_per_day as discussed in #2530.
The Problem:
On Windows, parallel execution (e.g., pytest -n) causes a FileNotFoundError. This is due to multiple processes clashing over the temporary file creation and renaming process.
The Fix:
Testing:
Verified on Windows 11. Parallel tests that previously failed now pass consistently.
Closes #2530