def vtr_command_main(arg_list, prog=None): """Run the vtr tasks given and the tasks in the lists given""" # Load the arguments args = vtr_command_argparser(prog).parse_args(arg_list) # Don't run if parsing or handling golden results args.run = not (args.parse or args.create_golden or args.check_golden or args.calc_geomean) # Always parse if running if args.run: args.parse = True num_failed = -1 try: task_names = args.task for list_file in args.list_file: task_names += load_list_file(list_file) config_files = [ find_task_config_file(task_name) for task_name in task_names ] configs = [] common_task_prefix = "" # common task prefix to shorten task names for config_file in config_files: config = load_task_config(config_file) configs += [config] if not common_task_prefix: common_task_prefix = config.task_name else: match = SequenceMatcher(None, common_task_prefix, config.task_name).find_longest_match( 0, len(common_task_prefix), 0, len(config.task_name)) common_task_prefix = common_task_prefix[match.a:match.a + match.size] if args.short_task_names: configs = shorten_task_names(configs, common_task_prefix) num_failed = run_tasks(args, configs) except CommandError as exception: print("Error: {msg}".format(msg=exception.msg)) print("\tfull command: ", exception.cmd) print("\treturncode : ", exception.returncode) print("\tlog file : ", exception.log) except InspectError as exception: print("Error: {msg}".format(msg=exception.msg)) if exception.filename: print("\tfile: ", exception.filename) except VtrError as exception: print("Error:", exception.msg) if __name__ == "main": sys.exit(num_failed) return num_failed
def vtr_command_main(arg_list, prog=None): """ Main function for parse_vtr_task Parses in the results from run_vtr_task.py """ # Load the arguments args = vtr_command_argparser(prog).parse_args(arg_list) try: task_names = args.task for list_file in args.list_file: task_names += load_list_file(list_file) config_files = [ find_task_config_file(task_name) for task_name in task_names ] configs = [ load_task_config(config_file) for config_file in config_files ] num_failed = 0 jobs = create_jobs(args, configs, after_run=True) parse_tasks(configs, jobs) if args.create_golden: create_golden_results_for_tasks(configs) if args.check_golden: num_failed += check_golden_results_for_tasks(configs) if args.calc_geomean: summarize_qor(configs) calc_geomean(args, configs) except CommandError as error: print("Error: {msg}".format(msg=error.msg)) print("\tfull command: ", error.cmd) print("\treturncode : ", error.returncode) print("\tlog file : ", error.log) num_failed += 1 except InspectError as error: print("Error: {msg}".format(msg=error.msg)) if error.filename: print("\tfile: ", error.filename) num_failed += 1 except VtrError as error: print("Error:", error.msg) num_failed += 1 return num_failed