def main(): parser = argparse.ArgumentParser( formatter_class=argparse.RawTextHelpFormatter) parser.add_argument("--conf", type=str, default="toy") parser.add_argument("--log", type=int, default=0, help="0 if log print out in screen else 1") parser.add_argument("--level", type=str, default="INFO", help="log level = INFO | DEBUG") args = parser.parse_args() params = dh.load_json(os.path.join(CONF_PATH, args.conf + ".json")) info = init(args, params["static_info"], params) info["logger"].debug("log level is DEBUG") info["logger"].info("init finished! \n %s \n" % (info)) res = {} for module in params["run_modules"]: info["logger"].info("run module: %s" % (module["func"])) mdl_name = module["func"] mdl_params = module["params"] mdl = __import__(mdl_name + "." + mdl_params["func"], fromlist=[mdl_name]) res[mdl_name] = getattr(mdl, mdl_name)(mdl_params, info=info, pre_res=res, mdl_name=mdl_name)
def main(): parser = argparse.ArgumentParser(formatter_class = argparse.RawTextHelpFormatter) parser.add_argument("--conf", type = str, default = "lc") parser.add_argument("--level", type = str, default = "INFO", help="log level = INFO | DEBUG") args = parser.parse_args() params = dh.load_json(os.path.join(CONF_PATH, args.conf + ".json")) info = init(args, params["static_info"], params) info["logger"].info("init finished! \n %s \n" %(info)) info["logger"].debug("log level is DEBUG") res = {} for module in params["run_modules"]: mdl_name = module["func"] mdl_params = module["params"] print (mdl_name) if info["debug_level"] == 'DEBUG': pdb.set_trace() #if mdl_name in ["metric"]: # continue mdl = __import__(mdl_name + "." + mdl_params["func"], fromlist=[mdl_name]) res[mdl_name] = getattr(mdl, mdl_name)(mdl_params, info = info, pre_res = res, mdl_name = mdl_name)