fix(diarizer/offline): propagate cancellation to workers - #886
Open
CiprianSpiridon wants to merge 2 commits into
Open
fix(diarizer/offline): propagate cancellation to workers#886CiprianSpiridon wants to merge 2 commits into
CiprianSpiridon wants to merge 2 commits into
Conversation
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.
Why is this change needed?
OfflineDiarizerManager.preparelaunches segmentation and embedding inference asdetached tasks. Detached tasks do not inherit cancellation from the caller, so
cancelling
process(URL)during a long recording can leave Core ML work runningafter the caller has given up. That prevents clients from reliably preempting
offline diarization when a higher-priority audio or transcription task needs the
device.
Changes
group rather than as detached tasks.
worker fails or is cancelled.
so returning
CancellationErroris also the shutdown boundary.call to return within two seconds, and verifies that progress does not continue
afterward.
There is no public API change. Successful diarization still returns the same
prepared segmentation and embedding results.
Test Plan
swift format lint --configuration .swift-format Sources/FluidAudio/Diarizer/Offline/Core/OfflineDiarizerManager.swift Tests/FluidAudioTests/Diarizer/Offline/OfflineDiarizerCancellationTests.swiftswift test --parallel --num-workers 8(2,332 discovered tests, exit 0)FLUIDAUDIO_CANCELLATION_TEST_AUDIO=/private/tmp/EN2002a.Mix-Headset.wav swift test --filter OfflineDiarizerCancellationTestsEN2002asingle-distant-microphonemeeting and locally cached production diarization models.
26.3, with no progress after the call returned.
The real-file regression skips when
FLUIDAUDIO_CANCELLATION_TEST_AUDIOor theoffline diarization models are unavailable, so the repository does not need to
bundle a large meeting recording or model artifacts.
Notes
The repository-wide format and test commands still emit existing warnings from
untouched files, including the unhandled
sample_medical.arpatest fixture. Thechanged files are format-clean, and the complete test command exits successfully.