[engine] do not fail on module import

If a module import fails, simply log a warning. The module, clearly,
cannot be used, though.

fixes #227
This commit is contained in:
Tobias Witek 2018-02-01 18:44:48 +01:00
parent bb38593f2d
commit 186169343d

View file

@ -216,9 +216,12 @@ class Engine(object):
def _read_aliases(self):
result = {}
for module in all_modules():
try:
mod = importlib.import_module("bumblebee.modules.{}".format(module["name"]))
for alias in getattr(mod, "ALIASES", []):
result[alias] = module["name"]
except Exception as error:
log.warning("failed to import {}: {}".format(module["name"], str(error)))
return result
def _load_module(self, module_name, config_name=None):