Skip to content

Continue interrupted analysis#956

Open
Josef-Haupt wants to merge 1 commit into
mainfrom
continue-analysis
Open

Continue interrupted analysis#956
Josef-Haupt wants to merge 1 commit into
mainfrom
continue-analysis

Conversation

@Josef-Haupt

Copy link
Copy Markdown
Member

Copilot AI review requested due to automatic review settings July 17, 2026 08:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a crash-safe “resume” mechanism for multi-file analyses (persisting per-file results as they complete) and introduces a GUI “Pause / Continue analysis” flow that can stop an in-progress run without latching global shutdown, so it can be resumed later.

Changes:

  • Add a resume journal (.birdnet-resume/) that stores per-file results and enables skipping already-completed files on the next run.
  • Extend inference plumbing to optionally use a per-file completion callback (on_file_complete) and add a non-latching pause cancellation path.
  • Update the multi-file GUI to show resume status, provide Pause/Continue UX, and add localization strings plus tests for pause/resume behavior.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
birdnet_analyzer/analyze/resume.py New resume journal implementation (manifest + per-file parquet partials + combine/finalize).
birdnet_analyzer/analyze/core.py Wire resume journal into analyze() for directory runs; support “all files already completed” resume path.
birdnet_analyzer/model_utils.py Add pause_active_analyses(), add on_file_complete support to run_inference(), and add supports_on_file_complete().
birdnet_analyzer/gui/multi_file.py Add Pause button, Continue label switching, and resume-status display based on journal inspection.
tests/analyze/test_resume.py New tests covering journal persistence, crash-safe resume behavior, invalid files, and “no inference needed” resume.
tests/test_model_utils.py New tests verifying pause cancels sessions without latching shutdown.
birdnet_analyzer/lang/en.json Add strings for Pause/Continue/resume status.
birdnet_analyzer/lang/de.json Add strings for Pause/Continue/resume status.
birdnet_analyzer/lang/fi.json Add strings for Pause/Continue/resume status.
birdnet_analyzer/lang/fr.json Add strings for Pause/Continue/resume status.
birdnet_analyzer/lang/id.json Add strings for Pause/Continue/resume status.
birdnet_analyzer/lang/pt-br.json Add strings for Pause/Continue/resume status.
birdnet_analyzer/lang/ru.json Add strings for Pause/Continue/resume status.
birdnet_analyzer/lang/se.json Add strings for Pause/Continue/resume status.
birdnet_analyzer/lang/tlh.json Add strings for Pause/Continue/resume status.
birdnet_analyzer/lang/zh_TW.json Add strings for Pause/Continue/resume status.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +157 to +161
# Only pass the kwarg when used: birdnet releases without the per-file
# completion hook reject it (see supports_on_file_complete()).
session_kwargs = (
{"on_file_complete": on_file_complete} if on_file_complete is not None else {}
)
Comment on lines +101 to +103
def _file_key(path) -> str:
normalized = os.path.normcase(os.path.normpath(str(path)))
return hashlib.sha1(normalized.encode("utf-8")).hexdigest()[:24]
Comment on lines +127 to +132
if manifest is not None and manifest.get("fingerprint") == fingerprint:
journal._metadata_written = manifest.get("metadata") is not None
if manifest.get("n_files_total") != n_files_total:
manifest["n_files_total"] = n_files_total
journal._write_manifest(manifest)
return journal
Comment on lines +104 to +109
- Directory analyses are resumable: per-file results are journaled to
``<output>/.birdnet-resume/`` as they complete, an interrupted run
picks up where it left off (if the analysis parameters match), and
the journal is removed after outputs are written. When resuming a
run that had already completed every file, no new inference happens
and ``None`` is returned instead of a prediction result.
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