Ejemplo n.º 1
0
    def new_result(self, mapping_key, name, hash_ignore=[]):
        if not self.connected():
            return Noop()

        mapping_id = self._mapping.get_id(mapping_key)
        if mapping_id is None:
            logging.debug("Test key '%s' has no mapping defined!" % mapping_key)
            return Noop()

        logging.debug("Test key '%s' mapped to id '%s'" % (mapping_key,
                                                           mapping_id))

        try:
            test = self._rest_api.test_get_by_id(mapping_id, log=False)
        except Exception as e:
            test = None
            logging.error(str(e))
        if test is None:
            try:
                test = self._rest_api.test_get_by_uid(mapping_id, log=False)
            except Exception as e:
                test = None
                logging.error(str(e))

        if test is not None:
            test_url = self._rest_api.get_obj_url(test)
            logging.debug("Found Test with id='%s' and uid='%s'! %s" % \
                            (test.get_id(), test.get_uid(), test_url))
        else:
            logging.debug("No Test with id or uid '%s' found!" % mapping_id)
            return Noop()

        logging.info("Creating a new result object for PerfRepo")
        result = PerfRepoResult(test, name, hash_ignore)
        return result
Ejemplo n.º 2
0
Archivo: Task.py Proyecto: jbenc/lnst
    def get_baseline(self, report_id):
        if report_id is None or not self.connected():
            return Noop()

        report = self._rest_api.report_get_by_id(report_id, log=False)
        if report is None:
            logging.debug("No report with id %s found!" % report_id)
            return Noop()
        logging.debug("Report found: %s" %\
                        self._rest_api.get_obj_url(report))

        baseline = report.get_baseline()

        if baseline is None:
            logging.debug("No baseline set for report %s" %\
                            self._rest_api.get_obj_url(report))
            return Noop()

        baseline_exec_id = baseline["execId"]
        baseline_testExec = self._rest_api.testExecution_get(baseline_exec_id,
                                                             log=False)

        logging.debug("TestExecution of baseline: %s" %\
                        self._rest_api.get_obj_url(baseline_testExec))
        return PerfRepoBaseline(baseline_testExec)
Ejemplo n.º 3
0
    def get_baseline_of_result(self, result):
        if not isinstance(result, PerfRepoResult) or not self.connected():
            return Noop()

        res_hash = result.generate_hash()
        logging.debug("Result hash is: '%s'" % res_hash)

        report_id = self._mapping.get_id(res_hash)
        if report_id is not None:
            logging.debug("Hash '%s' maps to report id '%s'" % (res_hash,
                                                               report_id))
        else:
            logging.debug("Hash '%s' has no mapping defined!" % res_hash)
            return Noop()

        baseline = self.get_baseline(report_id)

        if baseline.get_texec() is None:
            logging.debug("No baseline set for results with hash %s" % res_hash)
        return baseline
Ejemplo n.º 4
0
    def get_baseline(self, report_id):
        if report_id is None or not self.connected():
            return Noop()

        try:
            report = self._rest_api.report_get_by_id(report_id, log=False)
        except Exception as e:
            report = None
            logging.error(str(e))
        if report is None:
            logging.debug("No report with id %s found!" % report_id)
            return Noop()
        logging.debug("Report found: %s" %\
                        self._rest_api.get_obj_url(report))

        baseline = report.get_baseline()

        if baseline is None:
            logging.debug("No baseline set for report %s" %\
                            self._rest_api.get_obj_url(report))
            return Noop()

        baseline_exec_id = baseline["execId"]
        try:
            baseline_testExec = self._rest_api.testExecution_get(baseline_exec_id,
                                                                 log=False)
        except Exception as e:
            baseline_testExec = None
            logging.error(str(e))

        if baseline_testExec is not None:
            logging.debug("TestExecution of baseline: %s" %\
                            self._rest_api.get_obj_url(baseline_testExec))
        else:
            logging.debug("Couldn't get TestExecution of baseline.")
            return Noop()
        return PerfRepoBaseline(baseline_testExec)