fix(lora): wait for in-flight Civitai download before raising FileNotFoundError (#937)#939
Open
livepeer-tessa wants to merge 2 commits intomainfrom
Open
fix(lora): wait for in-flight Civitai download before raising FileNotFoundError (#937)#939livepeer-tessa wants to merge 2 commits intomainfrom
livepeer-tessa wants to merge 2 commits intomainfrom
Conversation
added 2 commits
April 14, 2026 06:25
…peline ID (#936) Signed-off-by: Tessa (livepeer-tessa) <tessa@livepeer.org>
…FoundError Fixes #937. When a session is re-initialised with a Civitai-hosted LoRA, the local Civitai download is re-triggered asynchronously while pipeline_manager concurrently calls LongLivePipeline.__init__. load_lora_weights was called synchronously before the download completed, causing a spurious FileNotFoundError that failed the pipeline load and left the session needing a manual retry. Fix: add _wait_for_lora_file() in lora/utils.py that polls for the file's existence before raising. The timeout defaults to 120 s and is configurable via SCOPE_LORA_DOWNLOAD_WAIT_TIMEOUT. No change to callers; existing FileNotFoundError semantics are preserved when the file genuinely does not appear within the timeout. Also adds tests/test_lora_wait_for_file.py covering: - file already present → returns immediately - file appears during wait → returns True - file never appears → returns False / raises after timeout - timeout=0 → disables waiting - SCOPE_LORA_DOWNLOAD_WAIT_TIMEOUT env var override Signed-off-by: Tessa (livepeer-tessa) <tessa@livepeer.org>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Contributor
🚀 fal.ai Preview Deployment
Livepeer Runner
Testing Livepeer Mode |
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.
Problem
Fixes #937.
When a session is re-initialised with a Civitai-hosted LoRA (e.g.
[flux.2.klein]pixelart_redmond-000032.safetensors), the download from Civitai is re-triggered asynchronously whilepipeline_managerconcurrently callsLongLivePipeline.__init__.load_lora_weightswas called synchronously before the download finished, causing:The session recovered on a retry (~1–2 min later) but the false error polluted logs alongside real missing-file errors (#923).
Fix
Added
_wait_for_lora_file()inlora/utils.py. Beforeload_lora_weightsraisesFileNotFoundError, it now polls for the file's existence for up to 120 seconds (configurable viaSCOPE_LORA_DOWNLOAD_WAIT_TIMEOUT).FileNotFoundErrorsemantics preserved for files that genuinely don't existtimeout=0disables the wait entirelySCOPE_LORA_DOWNLOAD_WAIT_TIMEOUToverrides the defaultTests
tests/test_lora_wait_for_file.py— 7 tests covering all branches.