Repository navigation
Tolerate coarse filesystem mtimes when confirming a short PSCAD run - #142
Open
qian-harvard wants to merge 1 commit into
Open
qian-harvard wants to merge 1 commit into
qian-harvard wants to merge 1 commit into
Conversation
run_project_to_completion accepts a run that finished between status polls only when an output file is fresh: changed since the pre-run snapshot and stamped at or after the recorded run start. File mtimes come from a coarser clock than time.time_ns() (kernel ticks on Linux, 2 s on FAT), so output written right after start could be stamped just before it, and a completed run was reported as not_completed. This made test_run_to_completion_accepts_short_run_between_polls fail intermittently on Linux CI. Allow 2 s of slack on the mtime comparison. The snapshot diff already proves the file changed during this call, and files with old timestamps are still rejected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Problem
run_project_to_completiontreats a run that finished between status polls as completed only when an output file is fresh. A fresh file has changed since the pre-run snapshot and is stamped at or after the recorded run start (time.time_ns()).File mtimes come from a coarser clock than
time.time_ns(): kernel ticks on Linux, 2 s on FAT. Output written right after start can therefore be stamped a few milliseconds before it, and a completed run comes back asnot_completed.This made
test_run_to_completion_accepts_short_run_between_pollsfail intermittently on Linux CI. The first run of the #138 merge on main failed this way on Python 3.10, and the re-run passed.Fix
Allow 2 s of slack on the mtime comparison in
_project_output_changed. The snapshot diff already proves the file changed during this call, so the slack can't admit stale output. Files with old timestamps are still rejected.Tests
test_run_to_completion_tolerates_coarse_filesystem_mtimestamps the output 1 s before it was written. It fails on main with the same'not_completed' != 'completed'as CI and passes with the fix.test_run_to_completion_rejects_output_far_older_than_runstamps the output an hour back. It checks that the slack stays bounded and that this output is still rejected.PSCAD/tests: 28 passed. Full CI suite locally on Python 3.12: 826 passed, 0 failed.🤖 Generated with Claude Code