Skip to content

Commit

Permalink
Merge pull request #98 from rjra2611/bug-datafeeds-not-storing-config…
Browse files Browse the repository at this point in the history
…-when-module-same-as-brokerage

Bug datafeeds not storing envrionment configs when module same as brokerage
  • Loading branch information
Martin-Molinero authored Jun 3, 2022
2 parents c80c3e3 + e3729a2 commit 1f3ef59
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
7 changes: 5 additions & 2 deletions lean/commands/live.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,14 @@ def _configure_lean_config_interactively(lean_config: Dict[str, Any], environmen
], multiple= True)
for data_feed in data_feeds:
if brokerage._id == data_feed._id:
# update essential properties from brokerage to datafeed
# update essential properties, so that other dependent values can be fetched.
essential_properties_value = {config._id : config._value for config in brokerage.get_essential_configs()}
data_feed.update_configs(essential_properties_value)
# now required properties can be fetched as per data/filter provider from esssential properties
required_properties_value = {config._id : config._value for config in brokerage.get_required_configs([InternalInputUserInput])}
data_feed.update_configs(required_properties_value)
# mark configs are updated
#TODO: create a setter method to set the property instead.
#TODO: create a setter method to set the property instead.
setattr(data_feed, '_is_installed_and_build', True)
data_feed.build(lean_config, logger).configure(lean_config, environment_name)

Expand Down
2 changes: 1 addition & 1 deletion lean/components/util/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def validate_option(input_value: Any):
return user_selected_value
else:
user_selected_values = []
user_inputs = click.prompt("To enter multiple options, seprate them with comma.", type=str, default=default, show_default=True)
user_inputs = click.prompt("To enter multiple options, separate them with comma.", type=str, default=default, show_default=True)
user_inputs = str(user_inputs).strip(",").split(",")
expected_outputs = len(user_inputs)
for user_input in user_inputs:
Expand Down
5 changes: 0 additions & 5 deletions lean/models/lean_config_configurer.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ def _configure_environment(self, lean_config: Dict[str, Any], environment_name:
:param lean_config: the Lean configuration dict to write to
:param environment_name: the name of the environment to update
"""
if self._is_installed_and_build:
return
self.ensure_module_installed()

for environment_config in self.get_configurations_env_values_from_name(environment_name):
environment_config_name = environment_config["name"]
if self.__class__.__name__ == 'DataFeed':
Expand All @@ -62,8 +59,6 @@ def configure_credentials(self, lean_config: Dict[str, Any]) -> None:
"""Configures the credentials in the Lean config for this brokerage and saves them persistently to disk.
:param lean_config: the Lean configuration dict to write to
"""
if self._is_installed_and_build:
return
if self._installs:
lean_config["job-organization-id"] = self.get_organzation_id()
for configuration in self._lean_configs:
Expand Down

0 comments on commit 1f3ef59

Please sign in to comment.