Esempio n. 1
0
    def load_input(self, settings):
        settings = settings.copy()
        results = []
        test_name = None
        for i, filename in enumerate(settings.INPUT):
            r = resultset.load(filename, settings.ABSOLUTE_TIME)
            if test_name is not None and test_name != r.meta("NAME") and \
               not settings.GUI:
                sys.stderr.write("Warning: result sets are not from the same "
                                 "test (found %s/%s).\n" % (test_name,
                                                            r.meta("NAME")))
            test_name = r.meta("NAME")
            if results and settings.CONCATENATE:
                results[0].concatenate(r)
            else:
                if len(settings.OVERRIDE_LABELS) > i:
                    r.set_label(settings.OVERRIDE_LABELS[i])
                results.append(r)

        settings.update(results[0].meta())
        settings.load_test(informational=True)

        # Look for missing data series, and if they are computed from other
        # values, try to compute them.
        for res in results:
            settings.compute_missing_results(res)

        formatter = formatters.new(settings)
        formatter.format(results)
Esempio n. 2
0
    def expand_argsets(self, batch, argsets, batch_time, batch_name,
                       print_status=True):

        for argset in itertools.product(*argsets):
            rep = argset[-1]
            argset = argset[:-1]
            settings = self.settings.copy()
            if print_status:
                sys.stderr.write(" args:%s rep:%02d" % (",".join(argset), rep))
                if settings.BATCH_DRY:
                    sys.stderr.write(" (dry run)")
                sys.stderr.write(".\n")
            settings.FORMAT = 'null'
            settings.BATCH_NAME = batch_name
            settings.BATCH_TIME = batch_time
            settings.TIME = datetime.utcnow()

            expand_vars = {'repetition': "%02d" % rep,
                           'batch_time': format_date(settings.BATCH_TIME,
                                                     fmt="%Y-%m-%dT%H%M%S")}

            for arg in argset:
                if arg not in self.args:
                    raise RuntimeError("Invalid arg: '%s'." % arg)
                expand_vars.update(self.args[arg])

            b = self.apply_args(batch, expand_vars, settings)

            if 'test_name' not in b:
                raise RuntimeError("Missing test name.")

            settings.load_rcvalues(b.items(), override=True)
            settings.NAME = b['test_name']
            settings.load_test(informational=settings.BATCH_DRY)
            settings.DATA_FILENAME = self.gen_filename(settings, b, argset, rep)

            yield b, settings
Esempio n. 3
0
    def run_test(self, settings, output_path, print_datafile_loc=False):
        settings = settings.copy()
        settings.load_test()
        res = resultset.new(settings)
        if settings.EXTENDED_METADATA:
            record_extended_metadata(res, settings.REMOTE_METADATA)

        if not settings.HOSTS:
            raise RuntimeError("Must specify host (-H option).")

        self.agg = aggregators.new(settings)
        res = self.agg.postprocess(self.agg.aggregate(res))
        if self.killed:
            return
        if settings.EXTENDED_METADATA:
            record_postrun_metadata(res, settings.REMOTE_METADATA)
        res.dump_dir(output_path)
        if print_datafile_loc:
            sys.stderr.write("Data file written to %s.\n" % res.dump_filename)

        formatter = formatters.new(settings)
        formatter.format([res])

        self.tests_run += 1