import admm from admm import * # Reading global cfg file (first argument-mandatory file) cfg_file = sys.argv[1] if not (os.path.exists(cfg_file)): sys.stderr.write('ERROR: The config file %s does not exist!\n' % (cfg_file)) sys.exit(0) else: config = configparser.ConfigParser() config.read(cfg_file) # Reading and parsing optional arguments from command line (e.g.,--optimization,lr=0.002) [section_args, field_args, value_args] = read_args_command_line(sys.argv, config) # Output folder creation out_folder = config['exp']['out_folder'] if not os.path.exists(out_folder): os.makedirs(out_folder + '/exp_files') # Log file path log_file = config['exp']['out_folder'] + '/log.log' # Read, parse, and check the config file cfg_file_proto = config['cfg_proto']['cfg_proto'] [config, name_data, name_arch] = check_cfg(cfg_file, config, cfg_file_proto) # Read cfg file options is_production = strtobool(config['exp']['production'])
return int(config["forward"]["max_nr_of_parallel_forwarding_processes"]) return -1 # Reading global cfg file (first argument-mandatory file) cfg_file = sys.argv[1] if not (os.path.exists(cfg_file)): sys.stderr.write("ERROR: The config file %s does not exist!\n" % (cfg_file)) sys.exit(0) else: config = configparser.ConfigParser() config.read(cfg_file) # Reading and parsing optional arguments from command line (e.g.,--optimization,lr=0.002) [section_args, field_args, value_args] = read_args_command_line(sys.argv, config) # Output folder creation out_folder = config["exp"]["out_folder"] if not os.path.exists(out_folder): os.makedirs(out_folder + "/exp_files") # Log file path log_file = config["exp"]["out_folder"] + "/log.log" # Read, parse, and check the config file cfg_file_proto = config["cfg_proto"]["cfg_proto"] [config, name_data, name_arch] = check_cfg(cfg_file, config, cfg_file_proto)
from data_io import preload_labels, check_if_fea_exist # Reading the configuration file (mandatory argument) cfg_file = sys.argv[1] # check if the config file exists if not (os.path.exists(cfg_file)): sys.stderr.write('ERROR: The config file %s does not exist!\n' % (cfg_file)) sys.exit(0) # read the config file config = config_to_dict(cfg_file) # Reading and parsing optional arguments from command line (e.g.,--optimization,lr=0.002) config = read_args_command_line(sys.argv, config) proto_file = config['cfg_proto']['cfg_proto'] # read proto file config_proto = config = config_to_dict(proto_file) sys.exit(0) # check consistency with the types specified in the proto files proto_file = config['cfg_proto']['cfg_proto'] print(proto_file) sys.exit(0) # writing on file the updated config dictionary dict_to_config(config, cfg_file)