Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughAdds an optional setting to cap worker threads used during dynamic component loading. The setting defaults to ChangesComponent loading worker limit
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Feature · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant SettingsService
participant import_langflow_components
participant _load_components_dynamically
participant ThreadPoolExecutor
participant ComponentModules
SettingsService->>import_langflow_components: provide component_load_max_workers
import_langflow_components->>_load_components_dynamically: pass worker limit
alt worker limit is configured
_load_components_dynamically->>ThreadPoolExecutor: submit module imports with worker cap
ThreadPoolExecutor->>ComponentModules: import modules
else worker limit is unset
_load_components_dynamically->>ComponentModules: import modules via asyncio.to_thread
end
Suggested reviewers: Merge Risk: ⚪ Minimal · up to
|
Add LANGFLOW_COMPONENT_LOAD_MAX_WORKERS to bound component import concurrency. Unset keeps the existing asyncio.to_thread behavior. Cover the propagation from import_langflow_components through the dev and production fallback paths, prove the configured executor caps concurrency, and document the new tests. Fixes langflow-ai#11354
313f077 to
3b642f7
Compare
|
@coderabbitai review Both pre-merge warnings from the previous review are addressed in 3b642f7:
|
✅ Action performedReview finished.
|
|
CI is green on 3b642f7. The Docker job's first attempt was interrupted by a runner shutdown (the image had already built and Authentication smoke check passed); the �erify or retry job then completed successfully, and the aggregating CI Success gate passed. Summary of the latest state:
eviewDecision is still REVIEW_REQUIRED, so this is ready for maintainer review. Happy to adjust anything if the reviewer wants a different default for the worker count. |
Fixes #11354
Why
In containers with CPU limits,
asyncio.to_thread()sizes its default threadpool from
os.cpu_count(), which can reflect the host node instead of thecontainer limit. Component loading can create substantially more threads than
the allocated CPU budget and make startup slow.
What changed
component_load_max_workersto the component settings.LANGFLOW_COMPONENT_LOAD_MAX_WORKERS.asyncio.to_thread()behavior when the setting is unset.ThreadPoolExecutorwhen a positive worker count isconfigured.
.env.exampleand add unit coverage.Validation
96 passed, 7 warnings in 98.13sruff check src/lfx/src/lfx/interface/components.py src/lfx/src/lfx/services/settings/groups/components.py src/lfx/tests/unit/test_component_index.py src/lfx/tests/unit/services/settings/test_settings_composition.py: passedruff format --checkon the same paths: passedAI assistance
Codex generated the implementation and tests from issue #11354. I reviewed the
full diff and ran the validation above.
Summary by CodeRabbit
LANGFLOW_COMPONENT_LOAD_MAX_WORKERS. When unset, the default thread pool remains in use.