def reload_once(prefix):
"""Reload all modules once."""
try_counter = 0
try:
for name, module in sys.modules.items():
if name.startswith(prefix):
log.debug("reloading module: '%s'", name)
imp.reload(module)
except OSError as e:
if try_counter >= Reloader.MAX_RELOAD_TRIES:
log.fatal("Too many tries to reload and no success. Fail.")
return
try_counter += 1
log.error("Received an error: %s on try %s. Try again.",
e, try_counter)
Reloader.reload_once(prefix)
评论列表
文章目录