X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=nm.py;h=46f23f5bd7fe6fd9d9e9c0c44443721f9d1aa063;hb=dd5d1e422d6ee5dd8a9986ab3506be27c9c88280;hp=ae92e07d28afb979698c1dce95dad0a7971db7dd;hpb=34eec336249f01daf1827c29f46f3906f723b46b;p=nodemanager.git diff --git a/nm.py b/nm.py index ae92e07..46f23f5 100644 --- a/nm.py +++ b/nm.py @@ -14,8 +14,8 @@ import logger import tools from config import Config -from plcapi import PLCAPI - +from plcapi import PLCAPI +import random savedargv = sys.argv[:] @@ -31,9 +31,13 @@ modules = [] def GetSlivers(plc): data = plc.GetSlivers() + # net needs access to API for i2 nodes. for module in modules: - callback = getattr(module, 'GetSlivers') - callback(data) + if module.__name__ == 'net': + module.GetSlivers(plc, data) + else: + callback = getattr(module, 'GetSlivers') + callback(data) def run(): try: @@ -51,7 +55,7 @@ def run(): print "Warning while writing PID file:", err # Load and start modules - for module in ['net', 'proper', 'conf_files', 'sm', 'bwmon']: + for module in ['net', 'proper', 'conf_files', 'sm']: try: m = __import__(module) m.start(options, config) @@ -71,7 +75,7 @@ def run(): while True: try: GetSlivers(plc) except: logger.log_exc() - time.sleep(options.period) + time.sleep(options.period + random.randrange(0,301)) except: logger.log_exc()