def repeat(argv): """Re-run a previous simulation or analysis.""" usage = "%(prog)s repeat LABEL" description = dedent("""\ Re-run a previous simulation/analysis under (in theory) identical conditions, and check that the results are unchanged.""") parser = ArgumentParser(usage=usage, description=description) parser.add_argument('original_label', metavar='LABEL', help='label of record to be repeated') parser.add_argument('-l', '--label', metavar='NEW_LABEL', help="specify a label for the new experiment. If no label is specified, one will be generated automatically.") args = parser.parse_args(argv) original_label = args.original_label project = load_project() new_label, original_label = project.repeat(original_label, args.label) diff = project.compare(original_label, new_label) if diff: formatter = get_diff_formatter()(diff) msg = ["The new record does not match the original. It differs as follows.", formatter.format('short'), "run smt diff --long %s %s to see the differences in detail." % (original_label, new_label)] msg = "\n".join(msg) else: msg = "The new record exactly matches the original." print(msg) project.add_comment(new_label, msg)
def repeat(argv): """Re-run a previous simulation or analysis.""" usage = "%(prog)s repeat LABEL" description = dedent("""\ Re-run a previous simulation/analysis under (in theory) identical conditions, and check that the results are unchanged.""") parser = ArgumentParser(usage=usage, description=description) parser.add_argument('original_label', metavar='LABEL', help='label of record to be repeated') parser.add_argument('-l', '--label', metavar='NEW_LABEL', help="specify a label for the new experiment. If no label is specified, one will be generated automatically.") args = parser.parse_args(argv) original_label = args.original_label project = load_project() new_label, original_label = project.repeat(original_label, args.label) diff = project.compare(original_label, new_label) if diff: formatter = get_diff_formatter()(diff) msg = ["The new record does not match the original. It differs as follows.", formatter.format('short'), "run smt diff --long %s %s to see the differences in detail." % (original_label, new_label)] msg = "\n".join(msg) else: msg = "The new record exactly matches the original." print(msg) project.add_comment(new_label, msg)
def show_diff(self, label1, label2, mode='short', ignore_mimetypes=[], ignore_filenames=[]): diff = self.compare(label1, label2, ignore_mimetypes, ignore_filenames) formatter = get_diff_formatter()(diff) return formatter.format(mode)
def show_diff(self, label1, label2, mode='short', ignore_mimetypes=[], ignore_filenames=[]): diff = self.compare(label1, label2, ignore_mimetypes, ignore_filenames) formatter = get_diff_formatter()(diff) return formatter.format(mode)