def dispatch_request(self, **kwargs): board = kwargs["board"] job = kwargs["job"] kernel = kwargs["kernel"] body_title = ("Details for Tree «%s» - %s" % (job, kernel)) page_title = "%s tests: %s - %s" % (board, job, kernel) page_title = "%s — %s" % (self.PAGE_TITLE, page_title) DISTINCT_LAB_NAMES_URL = "{:s}/distinct/lab_name/".format( app.config.get("TEST_SUITE_API_ENDPOINT")) payload = { "board": board, "job": job, "kernel": kernel, } data, status, headers = backend.request_get( backend.create_url(DISTINCT_LAB_NAMES_URL), params=payload, timeout=60 * 5) if status == 200: json_data = backend.extract_gzip_data(data, headers) return render_template("tests-board-job-kernel.html", body_title=body_title, page_title=page_title, board=board, job=job, kernel=kernel, lab_names=json_data["result"]) else: abort(status)
def _get_boots_count(result): """Get the boot counts. :param result: The boot element for which to get the count of. :type result: dict :return: A dictionary with the counts. """ queries = [] query_str = "status=%(status)s&job=%(job)s&kernel=%(kernel)s" total_query_str = "job=%(job)s&kernel=%(kernel)s" % result queries.append({ "method": "GET", "operation_id": "total_boots", "resource": "count", "document": "boot", "query": total_query_str }) result["status"] = "PASS" queries.append({ "method": "GET", "operation_id": "passed_boots", "resource": "count", "document": "boot", "query": query_str % result }) result["status"] = "FAIL" queries.append({ "method": "GET", "operation_id": "failed_boots", "resource": "count", "document": "boot", "query": query_str % result }) data, status, headers = backend.request_post( backend.create_url(CONFIG_GET("BATCH_API_ENDPOINT")), json.dumps({"batch": queries}), headers={"Content-Type": "application/json"}, timeout=60*60 ) if status == 200: count_results = _parse_batch_results( backend.extract_gzip_data(data, headers)) else: count_results = { "failed_boots": 0, "other_boots": 0, "passed_boots": 0, "total_boots": 0, } return count_results
def dispatch_request(self, **kwargs): board = kwargs["board"] job = kwargs["job"] kernel = kwargs["kernel"] body_title = ( "Details for Tree «%s» - %s" % (job, kernel)) page_title = "%s tests: %s - %s" % (board, job, kernel) page_title = "%s — %s" % (self.PAGE_TITLE, page_title) DISTINCT_LAB_NAMES_URL = "{:s}/distinct/lab_name/".format( app.config.get("TEST_GROUP_API_ENDPOINT")) payload = { "board": board, "job": job, "kernel": kernel, } data, status, headers = backend.request_get( backend.create_url(DISTINCT_LAB_NAMES_URL), params=payload, timeout=60*5) if status == 200: json_data = backend.extract_gzip_data(data, headers) return render_template( "tests-board-job-kernel.html", body_title=body_title, page_title=page_title, board=board, job=job, kernel=kernel, lab_names=json_data["result"] ) else: abort(status)
import dashboard.utils.backend as backend CONFIG_GET = app.config.get # The name of the feed. AUTHOR_NAME = "Kernel CI Feed Bot" # Default author information. AUTHOR = { "name": AUTHOR_NAME, "email": CONFIG_GET("INFO_EMAIL"), "uri": CONFIG_GET("BASE_URL") } # Necessary URLs for the feed. BUILD_URL = backend.create_url(CONFIG_GET("BUILD_API_ENDPOINT")) BUILD_FRONTEND_URL = ( CONFIG_GET("BASE_URL") + "/build/%(job)s/kernel/%(kernel)s/defconfig/%(defconfig_full)s/" "?_id=%(build_id)s" ) STORAGE_URL = ( CONFIG_GET("FILE_SERVER_URL") + "%(job)s/%(kernel)s/%(arch)s-%(defconfig_full)s/") # Some categories for the build feed. BUILD_FEED_CATEGORIES = [ {"term": "build"}, {"term": "ci"}, {"term": "linux"} ]
def _get_job_counts(query_params): """Retrieve the builds and boots count. :param query_params: The result from the previous query to be used as parameter. :type query_params: dict :return: A dictionary with the buils and boots count. """ queries = [] query_params["job_id"] = query_params["_id"]["$oid"] query_str = "status=%(status)s&job=%(job)s&kernel=%(kernel)s" total_query_str = "job=%(job)s&kernel=%(kernel)s" % query_params # Get the totals. queries.append({ "method": "GET", "operation_id": "total_builds", "resource": "count", "document": "build", "query": total_query_str }) queries.append({ "method": "GET", "operation_id": "total_boots", "resource": "count", "document": "boot", "query": total_query_str }) # Get the passed ones first. query_params["status"] = "PASS" queries.append({ "method": "GET", "operation_id": "passed_builds", "resource": "count", "document": "build", "query": query_str % query_params }) queries.append({ "method": "GET", "operation_id": "passed_boots", "resource": "count", "document": "boot", "query": query_str % query_params }) # Then the failed ones. query_params["status"] = "FAIL" queries.append({ "method": "GET", "operation_id": "failed_builds", "resource": "count", "document": "build", "query": query_str % query_params }) queries.append({ "method": "GET", "operation_id": "failed_boots", "resource": "count", "document": "boot", "query": query_str % query_params }) data, status, headers = backend.request_post( backend.create_url(CONFIG_GET("BATCH_API_ENDPOINT")), json.dumps({"batch": queries}), headers={"Content-Type": "application/json"}, timeout=60 * 60) if status == 200: count_results = _parse_batch_results( backend.extract_gzip_data(data, headers)) else: count_results = { "failed_boots": u"N/A", "failed_builds": u"N/A", "other_boots": u"N/A", "other_builds": u"N/A", "passed_boots": u"N/A", "passed_builds": u"N/A", "total_boots": u"N/A", "total_builds": u"N/A" } return count_results
import simple_json as json except ImportError: import json import copy import hashlib from flask import (current_app as app, request) import dashboard.utils.backend as backend import dashboard.utils.feed as feed CONFIG_GET = app.config.get # Necessary URLs for the feed. BACKEND_JOB_URL = backend.create_url(CONFIG_GET("JOB_API_ENDPOINT")) BASE_URL = CONFIG_GET("BASE_URL") FEED_TITLE = u"Built kernel \u00AB%(kernel)s\u00BB (%(git_branch)s)" FRONTEND_JOB_URL = BASE_URL + u"/job/%(job)s/" FRONTEND_JOB_BRANCH_URL = BASE_URL + u"/job/%(job)s/branch/%(git_branch)s/" BUILD_REPORTS_URL = BASE_URL + u"/build/%(job)s/kernel/%(kernel)s/" BOOT_REPORTS_URL = BASE_URL + u"/boot/all/job/%(job)s/kernel/%(kernel)s/" # Some base categories for the feed. FEED_CATEGORIES = [{"term": "job"}, {"term": "ci"}, {"term": "linux"}] def _parse_batch_results(results):
import dashboard.utils.backend as backend CONFIG_GET = app.config.get # The name of the feed. AUTHOR_NAME = "Kernel CI Feed Bot" # Default author information. AUTHOR = { "name": AUTHOR_NAME, "email": CONFIG_GET("INFO_EMAIL"), "uri": CONFIG_GET("BASE_URL") } # Necessary URLs for the feed. BUILD_URL = backend.create_url(CONFIG_GET("BUILD_API_ENDPOINT")) BUILD_FRONTEND_URL = ( CONFIG_GET("BASE_URL") + "/build/%(job)s/kernel/%(kernel)s/defconfig/%(defconfig_full)s/" "?_id=%(build_id)s") STORAGE_URL = (CONFIG_GET("FILE_SERVER_URL") + "%(job)s/%(kernel)s/%(arch)s-%(defconfig_full)s/") # Some categories for the build feed. BUILD_FEED_CATEGORIES = [{"term": "build"}, {"term": "ci"}, {"term": "linux"}] # Templates to be used in filling up the feed. HREF_BASE = u"<a href=\"%s\">%s</a>" NOT_AVAILABLE = u"Not available" BUILD_HTML_CONTENT = u""" <div>
import simple_json as json except ImportError: import json import copy import hashlib from flask import (current_app as app, request) import dashboard.utils.backend as backend import dashboard.utils.feed as feed CONFIG_GET = app.config.get # Necessary URLs for the feed. BACKEND_BOOT_URL = backend.create_url(CONFIG_GET("BOOT_API_ENDPOINT")) # Some base categories for the feed. FEED_CATEGORIES = [{"term": "boot"}, {"term": "ci"}, {"term": "linux"}] BASE_URL = CONFIG_GET("BASE_URL") BOOT_COMPLETE_FRONTEND_URL = ( BASE_URL + u"/boot/%(board)s/job/%(job)s/kernel/%(kernel)s" "/defconfig/%(defconfig_full)s/lab/%(lab_name)s/?_id=%(boot_id)s") def _parse_batch_results(results): """Parse the batch-count results. :param results: The results from the batch query. :type results: dict
import copy import hashlib from flask import ( current_app as app, request ) import dashboard.utils.backend as backend import dashboard.utils.feed as feed CONFIG_GET = app.config.get # Necessary URLs for the feed. BACKEND_BOOT_URL = backend.create_url(CONFIG_GET("BOOT_API_ENDPOINT")) BACKEND_BATCH_URL = backend.create_url(CONFIG_GET("BATCH_API_ENDPOINT")) BASE_URL = CONFIG_GET("BASE_URL") SOC_JOB_TITLE = ( u"%(job)s (%(git_branch)s) boot: %(failed_boots)s failed, " u"%(passed_boots)s passed, %(other_boots)s unknown, %(total_boots)s total") SOC_KERNEL_TITLE = ( u"%(kernel)s boot: %(failed_boots)s failed, " u"%(passed_boots)s passed, %(other_boots)s unknown, %(total_boots)s total") FRONTEND_SOC_URL = BASE_URL + u"/soc/%(mach)s/" FRONTEND_SOC_JOB_URL = BASE_URL + u"/soc/%(mach)s/job/%(job)s/" FRONTEND_JOB_URL = BASE_URL + u"/job/%(job)s/"
def _get_job_counts(query_params): """Retrieve the builds and boots count. :param query_params: The result from the previous query to be used as parameter. :type query_params: dict :return: A dictionary with the buils and boots count. """ queries = [] query_params["job_id"] = query_params["_id"]["$oid"] query_str = "status=%(status)s&job=%(job)s&kernel=%(kernel)s" total_query_str = "job=%(job)s&kernel=%(kernel)s" % query_params # Get the totals. queries.append({ "method": "GET", "operation_id": "total_builds", "resource": "count", "document": "build", "query": total_query_str }) queries.append({ "method": "GET", "operation_id": "total_boots", "resource": "count", "document": "boot", "query": total_query_str }) # Get the passed ones first. query_params["status"] = "PASS" queries.append( { "method": "GET", "operation_id": "passed_builds", "resource": "count", "document": "build", "query": query_str % query_params } ) queries.append( { "method": "GET", "operation_id": "passed_boots", "resource": "count", "document": "boot", "query": query_str % query_params } ) # Then the failed ones. query_params["status"] = "FAIL" queries.append( { "method": "GET", "operation_id": "failed_builds", "resource": "count", "document": "build", "query": query_str % query_params } ) queries.append( { "method": "GET", "operation_id": "failed_boots", "resource": "count", "document": "boot", "query": query_str % query_params } ) data, status, headers = backend.request_post( backend.create_url(CONFIG_GET("BATCH_API_ENDPOINT")), json.dumps({"batch": queries}), headers={"Content-Type": "application/json"}, timeout=60*60 ) if status == 200: count_results = _parse_batch_results( backend.extract_gzip_data(data, headers)) else: count_results = { "failed_boots": u"N/A", "failed_builds": u"N/A", "other_boots": u"N/A", "other_builds": u"N/A", "passed_boots": u"N/A", "passed_builds": u"N/A", "total_boots": u"N/A", "total_builds": u"N/A" } return count_results
import copy import hashlib from flask import ( current_app as app, request ) import dashboard.utils.backend as backend import dashboard.utils.feed as feed CONFIG_GET = app.config.get # Necessary URLs for the feed. BACKEND_JOB_URL = backend.create_url(CONFIG_GET("JOB_API_ENDPOINT")) BASE_URL = CONFIG_GET("BASE_URL") FEED_TITLE = u"Built kernel \u00AB%(kernel)s\u00BB (%(git_branch)s)" FRONTEND_JOB_URL = BASE_URL + u"/job/%(job)s/" FRONTEND_JOB_BRANCH_URL = BASE_URL + u"/job/%(job)s/branch/%(git_branch)s/" BUILD_REPORTS_URL = BASE_URL + u"/build/%(job)s/kernel/%(kernel)s/" BOOT_REPORTS_URL = BASE_URL + u"/boot/all/job/%(job)s/kernel/%(kernel)s/" # Some base categories for the feed. FEED_CATEGORIES = [ {"term": "job"}, {"term": "ci"}, {"term": "linux"}