fix: avoid calling set_ui_server_port() during LogSettings initialization (#1434)#1436
Open
utsab345 wants to merge 2 commits into
Open
fix: avoid calling set_ui_server_port() during LogSettings initialization (#1434)#1436utsab345 wants to merge 2 commits into
utsab345 wants to merge 2 commits into
Conversation
added 2 commits
June 30, 2026 22:26
…ctor_env/get_model_env
Both get_factor_env() and get_model_env() used extra_volumes: dict = {}
as default and unconditionally assigned env.conf.extra_volumes =
extra_volumes.copy(), which wiped out the correct defaults set by
QlibDockerConf (e.g., mounting ~/.qlib/ to /root/.qlib/). This caused
StopIteration in QTDockerEnv.prepare() when calling
next(iter(self.conf.extra_volumes.keys())) on the empty dict.
Changed default to None and only overwrite when a non-None value is
explicitly passed.
model_post_init should not depend on calling set_ui_server_port during instance creation. Inline the init-time logic directly so that LogSettings() construction is self-contained and does not rely on another method being available on the class.
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.
Summary
Fixes #1434.
This PR resolves an
AttributeErrorraised duringLogSettingsinitialization by removing the dependency onset_ui_server_port()insidemodel_post_init.Changes
Removed the call to
self.set_ui_server_port()fromLogSettings.model_post_init().Inlined only the initialization-specific logic required during model construction:
WebStoragetostorageswhenui_server_portis configured (including viaLOG_UI_SERVER_PORT).Preserved the existing
set_ui_server_port()method unchanged for runtime use after initialization.Why
model_post_init()should be self-contained and should not rely on another instance method during object construction. Callingset_ui_server_port()at initialization could result in anAttributeErrorif the method is unavailable at that stage of the model lifecycle.This change preserves the original behavior while making the initialization process more robust.
Testing
Verified the following:
LOG_UI_SERVER_PORTenvironment variable is handled correctly.server_uistarts successfully._run()subprocess path continues to work as expected.set_ui_server_port()remains available and functional for runtime updates.This change is limited to the initialization path and does not alter the runtime behavior of
set_ui_server_port().📚 Documentation preview 📚: https://RDAgent--1436.org.readthedocs.build/en/1436/