INNER CODE UNIT · Python
run_module
bkbilly/lnxlink · lnxlink/__main__.py:244
def run_module(self, name, method, retain=True, force_update=False, **kwargs):
"""Runs the method of a module"""
coalesce = kwargs.get("coalesce", True)
max_failures = 5
if self.module_failures.get(name, 0) >= max_failures:
return
try:
start_time = time.time()
if isinstance(method, (dict, list, bool, bytes, int, str, float)):
pub_data = method
else:
if "force_update" in inspect.signature(method).parameters:
pub_data = method(force_update=force_update)
else:
pub_data = method()
diff_time = round(time.time() - start_time, 5)
self.inference_times[name] = diff_time
self.module_failures[name] = 0