fix: preserve default Docker extra_volumes in factor/model envs (#1428)#1435
Open
utsab345 wants to merge 1 commit into
Open
fix: preserve default Docker extra_volumes in factor/model envs (#1428)#1435utsab345 wants to merge 1 commit into
utsab345 wants to merge 1 commit into
Conversation
…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.
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 #1428 by preserving the default Docker
extra_volumesconfiguration when no explicit volume mappings are provided.What changed
get_factor_env()to avoid overwritingenv.conf.extra_volumeswhenextra_volumesis empty.get_model_env()to keep the behavior consistent across both environment factories.QlibDockerConfdefault volume mappings unless the caller explicitly provides custom mappings.Why
Both
get_factor_env()andget_model_env()initializedextra_volumeswith an empty dictionary and unconditionally assigned it toenv.conf.extra_volumes.As a result, the default
QlibDockerConfmount:~/.qlib/→/root/.qlib/was replaced with an empty dictionary. Consequently,
QTDockerEnv.prepare()attempted to access the first configured volume and raised aStopIteration, preventing Docker-based factor/model workflows from starting.With this change, the default configuration is preserved unless the caller explicitly supplies custom volume mappings.
Testing
StopIterationwhile the updated implementation preserves the default configuration.python -m py_compilepassed for all modified files.Files Changed
rdagent/components/coder/factor_coder/config.pyrdagent/components/coder/model_coder/config.pyBranch
fix/extra-volumes-overwrite-bugCommit
477b6bcCloses #1428.
📚 Documentation preview 📚: https://RDAgent--1435.org.readthedocs.build/en/1435/