def _get_file_content(self, master, builder, test_type, build_number,
                          name):
        """Return content of the file that matches builder and file name.

        Args:
            builder: builder name
            test_type: type of the test
            build_number: build number, or 'latest'
            name: file name
        """

        files = TestFile.get_files(master,
                                   builder,
                                   test_type,
                                   build_number,
                                   name,
                                   load_data=True,
                                   limit=1)
        if not files:
            logging.info(
                "File not found, master %s, builder: %s, test_type: %s, build_number: %s, name: %s.",
                master, builder, test_type, build_number, name)
            return None, None

        return files[0].data, files[0].date
Esempio n. 2
0
    def _get_file_list(self, builder, test_type, name):
        """Get and display a list of files that matches builder and file name.

        Args:
            builder: builder name
            test_type: type of the test
            name: file name
        """

        files = TestFile.get_files(
            builder, test_type, name, load_data=False, limit=100)
        if not files:
            logging.info("File not found, builder: %s, test_type: %s, name: %s.",
                         builder, test_type, name)
            self.response.out.write("File not found")
            return

        template_values = {
            "admin": users.is_current_user_admin(),
            "builder": builder,
            "test_type": test_type,
            "name": name,
            "files": files,
        }
        self.response.out.write(template.render("templates/showfilelist.html",
                                                template_values))
    def update(cls, builder, test_type, incremental):
        """Update datastore json file data by merging it with incremental json
           file.

        Args:
            builder: builder name.
            test_type: type of test results.
            incremental: incremental json file data to merge.

        Returns:
            TestFile object if update succeeds or
            None on failure.
        """

        files = TestFile.get_files(builder, test_type, JSON_RESULTS_FILE)
        if files:
            file = files[0]
            new_results = cls.merge(builder, file.data, incremental)
        else:
            # Use the incremental data if there is no aggregated file to merge.
            file = TestFile()
            file.builder = builder
            file.test_type = test_type
            file.name = JSON_RESULTS_FILE
            new_results = incremental
            logging.info(
                "No existing json results, incremental json is saved.")

        if not new_results:
            return None

        if not file.save(new_results):
            return None

        return file
Esempio n. 4
0
    def _get_file_list(self, master, builder, test_type, name, callback_name=None):
        """Get and display a list of files that matches builder and file name.

        Args:
            builder: builder name
            test_type: type of the test
            name: file name
        """

        files = TestFile.get_files(
            master, builder, test_type, name, load_data=False, limit=100)
        if not files:
            logging.info("File not found, master: %s, builder: %s, test_type: %s, name: %s.",
                         master, builder, test_type, name)
            self.response.out.write("File not found")
            return

        template_values = {
            "admin": users.is_current_user_admin(),
            "master": master,
            "builder": builder,
            "test_type": test_type,
            "name": name,
            "files": files,
        }
        if callback_name:
            json = template.render("templates/showfilelist.jsonp", template_values)
            self._serve_json(_replace_jsonp_callback(json, callback_name), files[0].date)
            return
        self.response.out.write(template.render("templates/showfilelist.html",
                                                template_values))
Esempio n. 5
0
    def _get_file_list(self, builder, test_type, name):
        """Get and display a list of files that matches builder and file name.

        Args:
            builder: builder name
            test_type: type of the test
            name: file name
        """

        files = TestFile.get_files(builder,
                                   test_type,
                                   name,
                                   load_data=False,
                                   limit=100)
        if not files:
            logging.info(
                "File not found, builder: %s, test_type: %s, name: %s.",
                builder, test_type, name)
            self.response.out.write("File not found")
            return

        template_values = {
            "admin": users.is_current_user_admin(),
            "builder": builder,
            "test_type": test_type,
            "name": name,
            "files": files,
        }
        self.response.out.write(
            template.render("templates/showfilelist.html", template_values))
Esempio n. 6
0
    def update(cls, builder, test_type, incremental):
        """Update datastore json file data by merging it with incremental json
           file.

        Args:
            builder: builder name.
            test_type: type of test results.
            incremental: incremental json file data to merge.

        Returns:
            TestFile object if update succeeds or
            None on failure.
        """

        files = TestFile.get_files(builder, test_type, JSON_RESULTS_FILE)
        if files:
            file = files[0]
            new_results = cls.merge(builder, file.data, incremental)
        else:
            # Use the incremental data if there is no aggregated file to merge.
            file = TestFile()
            file.builder = builder
            file.test_type = test_type
            file.name = JSON_RESULTS_FILE
            new_results = incremental
            logging.info("No existing json results, incremental json is saved.")

        if not new_results:
            return None

        if not file.save(new_results):
            return None

        return file
    def _get_file_list(self, master, builder, test_type, name, before, limit, callback_name=None):
        """Get and display a list of files that matches builder and file name.

        Args:
            builder: builder name
            test_type: type of the test
            name: file name
        """

        files = TestFile.get_files(
            master, builder, test_type, name, before, load_data=False, limit=limit)
        if not files:
            logging.info("File not found, master: %s, builder: %s, test_type: %s, name: %s.",
                         master, builder, test_type, name)
            self.response.out.write("File not found")
            return

        template_values = {
            "admin": users.is_current_user_admin(),
            "master": master,
            "builder": builder,
            "test_type": test_type,
            "name": name,
            "files": files,
        }
        if callback_name:
            json = template.render("templates/showfilelist.jsonp", template_values)
            self._serve_json(_replace_jsonp_callback(json, callback_name), files[0].date)
            return
        self.response.out.write(template.render("templates/showfilelist.html",
                                                template_values))
Esempio n. 8
0
    def _get_file(cls, master, builder, test_type, filename):
        files = TestFile.get_files(master, builder, test_type, filename)
        if files:
            return files[0]

        file = TestFile()
        file.master = master
        file.builder = builder
        file.test_type = test_type
        file.name = filename
        file.data = ""
        return file
Esempio n. 9
0
    def _get_file(cls, master, builder, test_type, filename):
        files = TestFile.get_files(master, builder, test_type, filename)
        if files:
            return files[0]

        file = TestFile()
        file.master = master
        file.builder = builder
        file.test_type = test_type
        file.name = filename
        file.data = ""
        return file
Esempio n. 10
0
    def _get_file_content(self, builder, test_type, name):
        """Return content of the file that matches builder and file name.

        Args:
            builder: builder name
            test_type: type of the test
            name: file name
        """

        files = TestFile.get_files(
            builder, test_type, name, load_data=True, limit=1)
        if not files:
            logging.info("File not found, builder: %s, test_type: %s, name: %s.",
                         builder, test_type, name)
            return None

        return files[0].data
Esempio n. 11
0
    def _get_file_content(self, master, builder, test_type, build_number, name):
        """Return content of the file that matches builder and file name.

        Args:
            builder: builder name
            test_type: type of the test
            build_number: build number, or 'latest'
            name: file name
        """

        files = TestFile.get_files(
            master, builder, test_type, build_number, name, load_data=True, limit=1)
        if not files:
            logging.info("File not found, master %s, builder: %s, test_type: %s, build_number: %s, name: %s.",
                         master, builder, test_type, build_number, name)
            return None, None

        return files[0].data, files[0].date
Esempio n. 12
0
    def update_file(cls, master, builder, test_type, incremental, is_full_results_format, filename, num_runs):
        files = TestFile.get_files(master, builder, test_type, filename)
        if files:
            file = files[0]
        else:
            file = TestFile()
            file.master = master
            file.builder = builder
            file.test_type = test_type
            file.name = filename
            file.data = ""

        new_results = cls.merge(builder, file.data, incremental, is_full_results_format, num_runs)

        if not new_results or not file.save(new_results):
            logging.info("Update failed, master: %s, builder: %s, test_type: %s, name: %s." % (master, builder, test_type, filename))
            return False

        return True
Esempio n. 13
0
    def update_file(cls, master, builder, test_type, incremental, filename, num_runs):
        files = TestFile.get_files(master, builder, test_type, filename)
        if files:
            file = files[0]
            new_results = cls.merge(builder, file.data, incremental, num_runs)
        else:
            # Use the incremental data if there is no aggregated file to merge.
            file = TestFile()
            file.master = master
            file.builder = builder
            file.test_type = test_type
            file.name = filename
            new_results = incremental
            logging.info("No existing json results, incremental json is saved.")

        if not new_results or not file.save(new_results):
            logging.info("Update failed, master: %s, builder: %s, test_type: %s, name: %s." % (master, builder, test_type, filename))
            return False

        return True
Esempio n. 14
0
    def _get_file_content(self, builder, test_type, name):
        """Return content of the file that matches builder and file name.

        Args:
            builder: builder name
            test_type: type of the test
            name: file name
        """

        files = TestFile.get_files(builder, test_type, name, 1)
        if not files:
            logging.info(
                "File not found, builder: %s, test_type: %s, name: %s.",
                builder, test_type, name)
            return

        blob_key = files[0].blob_key
        blob_info = blobstore.get(blob_key)
        if blob_info:
            self.send_blob(blob_info, "text/plain")
Esempio n. 15
0
    def _get_file_content(self, builder, test_type, name):
        """Return content of the file that matches builder and file name.

        Args:
            builder: builder name
            test_type: type of the test
            name: file name
        """

        files = TestFile.get_files(builder,
                                   test_type,
                                   name,
                                   load_data=True,
                                   limit=1)
        if not files:
            logging.info(
                "File not found, builder: %s, test_type: %s, name: %s.",
                builder, test_type, name)
            return None

        return files[0].data
Esempio n. 16
0
    def update_file(cls, master, builder, test_type, incremental, filename,
                    num_runs):
        files = TestFile.get_files(master, builder, test_type, filename)
        if files:
            file = files[0]
            new_results = cls.merge(builder, file.data, incremental, num_runs)
        else:
            # Use the incremental data if there is no aggregated file to merge.
            file = TestFile()
            file.master = master
            file.builder = builder
            file.test_type = test_type
            file.name = filename
            new_results = incremental
            logging.info(
                "No existing json results, incremental json is saved.")

        if not new_results or not file.save(new_results):
            logging.info(
                "Update failed, master: %s, builder: %s, test_type: %s, name: %s."
                % (master, builder, test_type, filename))
            return False

        return True