You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: when running commands via the deepsearcher CLI, the configuration file located at deepsearcher/config.yaml seems to be loaded twice.
Describe the bug
It appears that the Configuration() class is instantiated multiple times within the execution path of a single CLI command (in cli.py). This results in the configuration file being read and potentially processed twice unnecessarily.
To Reproduce
Modify the deepsearcher/configuration.py file.
Add a print(config_path) statement inside the __init__ method of the Configuration class, right at the beginning (around line 36).
classConfiguration:
def__init__(self, config_path: str=DEFAULT_CONFIG_YAML_PATH):
print(f"Initializing Configuration with path: {config_path}") # Added for debugging# ... rest of the init method ...
Run a deepsearcher CLI command (e.g., deepsearcher load ... or any other command that initializes the configuration).
Observe the terminal output. You will see the "Initializing Configuration with path: ..." message printed twice, indicating that the Configuration class constructor is being called twice during the execution of a single command.
Expected behavior
The configuration file should ideally be loaded only once per CLI command invocation to ensure efficiency and consistency.
Refactor the CLI command handling code (in cli.py) to ensure that the Configuration object is instantiated only once and shared where needed within the scope of a single command execution.
The text was updated successfully, but these errors were encountered:
@null0NULL123 thank you for this suggestion, it's an issue. I think currently the cli configration is not flexible. I want to add a cli argument named config_path to align config approach with other ends, as well as make the cli configration more flexible. What 's your opinion?
I think adding a --config_path CLI argument is a good idea. Also, I think the global config = Configuration() instance on line 174 of configuration.py should be removed in that it is also initialized in cli.py. @zc277584121
Uh oh!
There was an error while loading. Please reload this page.
Note: when running commands via the deepsearcher CLI, the configuration file located at deepsearcher/config.yaml seems to be loaded twice.
Describe the bug
It appears that the Configuration() class is instantiated multiple times within the execution path of a single CLI command (in cli.py). This results in the configuration file being read and potentially processed twice unnecessarily.
To Reproduce
deepsearcher/configuration.py
file.print(config_path)
statement inside the__init__
method of theConfiguration
class, right at the beginning (around line 36).deepsearcher
CLI command (e.g.,deepsearcher load ...
or any other command that initializes the configuration).Configuration
class constructor is being called twice during the execution of a single command.Expected behavior
The configuration file should ideally be loaded only once per CLI command invocation to ensure efficiency and consistency.
Refactor the CLI command handling code (in cli.py) to ensure that the Configuration object is instantiated only once and shared where needed within the scope of a single command execution.
The text was updated successfully, but these errors were encountered: