Skip to content

FLASHIda: a status file Windows will not replace no longer stops the acquisition - #284

Open
PhilippKaulich wants to merge 2 commits into
OpenMS:developfrom
PhilippKaulich:fix/flashida-status-access-denied
Open

PhilippKaulich wants to merge 2 commits into
OpenMS:developfrom
PhilippKaulich:fix/flashida-status-access-denied

Conversation

@PhilippKaulich

@PhilippKaulich PhilippKaulich commented Nov 13, 2026 •

Copy link
Copy Markdown

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_status raised, 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_status tries 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 returns False. Other errors are not retried.
  • newest_sequence (the newest Xcalibur .sld in the raw folder) skips a sequence that is removed or locked while it is looked at — in the listing (is_file reads the file's metadata too) as well as by date — instead of raising.
  • remember_log_folder goes 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_status raises PermissionError [WinError 5] Access is denied — the error that stopped the acquisition. With this change, held open the whole time: returns False after ~1 s, no exception, no .tmp left; released after 0.3 s: the status is written.

  • tests/test_flashida.py: new test_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) and test_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 on develop.

  • pylint (errors-only, CI flags) on the changed files: no messages.

🤖 Generated with Claude Code

…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>
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 258a2bb4-d0b1-43b8-af0a-d4cf4f9e8876
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@t0mdavid-m t0mdavid-m left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@PhilippKaulich

Copy link
Copy Markdown
Author

Thanks for the review. Done in 084c6de: both write_status calls around run_command in src/Workflow.py now log a warning when they return False. If the "running" write fails, the log says that the page keeps the old status of the run while FLASHIda runs; if the write after it fails, the log says the page catches up at the next poll. The per-poll write stays silent, since it is retried at every poll and a warning there would repeat every few seconds.

tests/test_flashida.py passes (13 tests), pylint (errors-only, CI flags) reports nothing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants