Skip to content

Commit

Permalink
Merge pull request #2021 from solliancenet/cp_load_modules
Browse files Browse the repository at this point in the history
Handle case where there are no external modules to load.
  • Loading branch information
ciprianjichici authored Dec 3, 2024
2 parents ffbe582 + 081daec commit 1aa5ac1
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions src/python/PythonSDK/foundationallm/plugins/plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,24 +72,25 @@ def __init__(self, config:Configuration, logger:Logger):
container_name=storage_container_name,
authentication_type=storage_authentication_type
)

for module_configuration in [x.split('|') for x in modules_list.split(',')]:
module_file = module_configuration[0]
module_name = module_configuration[1]
plugin_manager_type = module_configuration[2]
plugin_manager_class_name = module_configuration[3]

if (plugin_manager_type != TOOLS_PLUGIN_MANAGER_TYPE):
raise ValueError(f'The plugin manager type {plugin_manager_type} is not recognized.')

if module_name in self.external_modules:
self.external_modules[module_name].tool_plugin_manager_class_name = plugin_manager_class_name
else:
self.external_modules[module_name] = ExternalModule(
module_file=module_file,
module_name=module_name,
tool_plugin_manager_class_name=plugin_manager_class_name
)

if modules_list is not None and modules_list.strip() != '':
for module_configuration in [x.split('|') for x in modules_list.split(',')]:
module_file = module_configuration[0]
module_name = module_configuration[1]
plugin_manager_type = module_configuration[2]
plugin_manager_class_name = module_configuration[3]

if (plugin_manager_type != TOOLS_PLUGIN_MANAGER_TYPE):
raise ValueError(f'The plugin manager type {plugin_manager_type} is not recognized.')

if module_name in self.external_modules:
self.external_modules[module_name].tool_plugin_manager_class_name = plugin_manager_class_name
else:
self.external_modules[module_name] = ExternalModule(
module_file=module_file,
module_name=module_name,
tool_plugin_manager_class_name=plugin_manager_class_name
)

self.initialized = True
self.logger.info('The plugin manager initialized successfully.')
Expand Down

0 comments on commit 1aa5ac1

Please sign in to comment.