droxit / roxcomposer

This is the droxit microservice framework repository.
GNU Lesser General Public License v3.0
5 stars 0 forks source link

Error when starting a service based on second level of inheritance from base_service. #89

Closed hecktor-droxit closed 5 years ago

hecktor-droxit commented 5 years ago

It seems to be impossible to start a service which is a "subsubclass" of base_service (second level of inheritance. In this case, "str_service.StrService" is the direct subclass of "base_service" whereas "lowercaser.Lowercaser" is derived from "StrService".

Traceback (most recent call last): File "/home/christian/.local/lib/python3.6/site-packages/roxcomposer/service_loader.py", line 16, in load_class mod = importlib.import_module(modpath) File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/home/christian/.local/lib/python3.6/site-packages/roxcomposer/tests/classes/lowercaser.py", line 13, in from str_service import StrService ModuleNotFoundError: No module named 'str_service'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "plugins/service_container.py", line 17, in srv = roxcomposer.service_loader.make_service_instance(classpath, args) File "/home/christian/.local/lib/python3.6/site-packages/roxcomposer/service_loader.py", line 30, in make_service_instance c = load_class(classpath) File "/home/christian/.local/lib/python3.6/site-packages/roxcomposer/service_loader.py", line 19, in load_class raise exceptions.ConfigError('Failed to load the specified logging class: {} - {}'.format(classpath, e)) from e roxcomposer.exceptions.ConfigError: Failed to load the specified logging class: roxcomposer.tests.classes.lowercaser.Lowercaser - No module named 'str_service'

hecktor-droxit commented 5 years ago

Indicating full path to implementation file in user's home directory solves the issue. Therefore, the "full path" variant to indicate service implementation should be preferred. The "classpath" variant is unintuitive and prone to errors.