Continue interrupted analysis#956
Open
Josef-Haupt wants to merge 1 commit into
Open
Conversation
Josef-Haupt
commented
Jul 17, 2026
Member
- relies on On file complete hook birdnet#57 (not yet merged)
Contributor
There was a problem hiding this comment.
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. |
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.