Repository navigation
FLASHIda: a status file Windows will not replace no longer stops the acquisition - #284
PhilippKaulich wants to merge 2 commits into
Conversation
…acquisition On Windows, replacing ida-status.json is refused (PermissionError, WinError 5) while the Acquisition page, a virus scanner or OneDrive has the file open. write_status raised, and the acquisition stopped with "Access is denied". - write_status tries the replace again for about a second, then leaves the old status until its next write (every poll) and returns False; the temporary file is removed. - newest_sequence skips a sequence it cannot read (removed or locked while the raw folder is looked at), in the listing as well as by date. - remember_log_folder goes on when its list of log folders cannot be written. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
t0mdavid-m
left a comment
There was a problem hiding this comment.
The retry loop in write_status (PermissionError, tmp file removed on failure) and the tolerant newest_sequence / remember_log_folder look sound. The PR's tests pass. One local failure, test_only_in_the_local_app_with_developer_mode, comes from psutil missing in my environment and is unrelated.
One suggestion: src/Workflow.py ignores the bool write_status now returns (the calls before and after run_command). If the "running" write before the blocking run_command fails, the page shows a stale status for the whole acquisition without saying why. A log line when it returns False, at least for that call, would make this visible.
Generated by Claude Code
The writes before and after FLASHIda runs now log a warning when write_status returns False, so a status the page cannot update during an acquisition is explained in the log. The per-poll write stays silent: it is retried at every poll. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the review. Done in 084c6de: both
|
Summary
A FLASHIda acquisition on the instrument PC no longer stops with "Access is denied" when Windows refuses to replace its status file.
Why it occurs. The acquisition writes
ida-status.json(which runs are scheduled, which is running) on every poll, by writing a temporary file and replacing the status file with it. On Windows that replace is refused (PermissionError, WinError 5) while another process has the status file open: the Acquisition page reading it, a virus scanner, or OneDrive syncing the workspace.write_statusraised, and the acquisition stopped.Why it has to be solved. The status file is only for the page. Losing one update is harmless — the next poll writes it again — but stopping the acquisition loses the runs still to come on the instrument.
Why this way.
write_statustries the replace again for about a second (20 × 50 ms), which outlasts a page read or a scanner's look; still refused, it removes the temporary file, leaves the old status until the next poll and returnsFalse. Other errors are not retried.newest_sequence(the newest Xcalibur.sldin the raw folder) skips a sequence that is removed or locked while it is looked at — in the listing (is_filereads the file's metadata too) as well as by date — instead of raising.remember_log_foldergoes on when its list of log folders cannot be written; the Viewer then misses that folder, the acquisition goes on.No visible change in the app, so no screenshots: the Acquisition page shows the same status, now also when Windows held the file for a moment.
Tests
Real Windows lock, no mocks (Windows 11): the status file held open by another handle, as the page, a virus scanner or OneDrive do. On
develop,write_statusraisesPermissionError [WinError 5] Access is denied— the error that stopped the acquisition. With this change, held open the whole time: returnsFalseafter ~1 s, no exception, no.tmpleft; released after 0.3 s: the status is written.tests/test_flashida.py: newtest_write_status_retries_a_refused_replace(two refusals, then written),test_write_status_gives_up_without_stopping(always refused:False, the old status kept, no temporary file left, no exception) andtest_newest_sequence_skips_a_file_it_cannot_read.pytest tests/test_flashida*.py tests/test_ida_*.py tests/test_validation_data.py(Python 3.11, Windows): 105 passed; the 9 errors are the demo-workspace symlinks (WinError 1314), the same ondevelop.pylint (errors-only, CI flags) on the changed files: no messages.
🤖 Generated with Claude Code