コード例 #1
0
ファイル: test.py プロジェクト: gctucker/kernelci-frontend
    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)
コード例 #2
0
ファイル: boot.py プロジェクト: kernelci/kernelci-frontend
def _get_boot_data(req_params):
    """Get the boot data from the backend.

    :param req_params: The parameters for the request. They will be added to
    the default ones.
    :type req_params: dict
    :return: The response from the backend as a dictionary.
    """
    results = []

    default_params = [
        ("date_range", 1),
        ("sort", "created_on"),
        ("sort_order", -1)
    ]

    if req_params:
        default_params.extend(req_params)

    data, status, headers = backend.request_get(
        BACKEND_BOOT_URL, params=default_params, timeout=60*60)

    if status == 200:
        results = backend.extract_gzip_data(data, headers)

    return results
コード例 #3
0
ファイル: boot.py プロジェクト: dzickusrh/kernelci-frontend
def _get_boot_data(req_params):
    """Get the boot data from the backend.

    :param req_params: The parameters for the request. They will be added to
    the default ones.
    :type req_params: dict
    :return: The response from the backend as a dictionary.
    """
    results = []

    default_params = [
        ("date_range", 1),
        ("sort", "created_on"),
        ("sort_order", -1)
    ]

    if req_params:
        default_params.extend(req_params)

    data, status, headers = backend.request_get(
        BACKEND_BOOT_URL, params=default_params, timeout=60*60)

    if status == 200:
        results = backend.extract_gzip_data(data, headers)

    return results
コード例 #4
0
ファイル: boot.py プロジェクト: kernelci/kernelci-frontend
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
コード例 #5
0
ファイル: boot.py プロジェクト: dzickusrh/kernelci-frontend
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
コード例 #6
0
ファイル: soc.py プロジェクト: kernelci/kernelci-frontend
def _get_soc_data(req_params):
    """Retrieve the SoC data from the backend.

    :param req_params: The parameters for the request. They will be added to
    the default ones.
    :type req_params: dict
    :return: The results from the backend.
    """
    results = []
    params = [
        ("date_range", 1),
        (
            "field",
            (
                "build_id",
                "created_on",
                "git_branch",
                "git_commit",
                "git_url",
                "job",
                "job_id",
                "kernel",
                "mach"
            )
        ),
        ("sort", "created_on"),
        ("sort_order", -1)
    ]
    if req_params:
        params.extend(req_params)

    data, status, headers = backend.request_get(
        BACKEND_BOOT_URL, params=params, timeout=60*60)

    if status == 200:
        results = backend.extract_gzip_data(data, headers)

    return results
コード例 #7
0
ファイル: soc.py プロジェクト: alexandrasp/kernelci-frontend
def _get_soc_data(req_params):
    """Retrieve the SoC data from the backend.

    :param req_params: The parameters for the request. They will be added to
    the default ones.
    :type req_params: dict
    :return: The results from the backend.
    """
    results = []
    params = [
        ("date_range", 1),
        (
            "field",
            (
                "build_id",
                "created_on",
                "git_branch",
                "git_commit",
                "git_url",
                "job",
                "job_id",
                "kernel",
                "mach"
            )
        ),
        ("sort", "created_on"),
        ("sort_order", -1)
    ]
    if req_params:
        params.extend(req_params)

    data, status, headers = backend.request_get(
        BACKEND_BOOT_URL, params=params, timeout=60*60)

    if status == 200:
        results = backend.extract_gzip_data(data, headers)

    return results
コード例 #8
0
ファイル: test.py プロジェクト: kernelci/kernelci-frontend
    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)
コード例 #9
0
ファイル: job.py プロジェクト: dzickusrh/kernelci-frontend
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
コード例 #10
0
ファイル: soc.py プロジェクト: kernelci/kernelci-frontend
def _get_boot_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_str = "status=%(status)s&job=%(job)s&mach=%(mach)s"
    total_query_str = "job=%(job)s&mach=%(mach)s" % query_params

    if query_params.get("job_id", None):
        query_str += "&job_id=" + query_params["job_id"]["$oid"]
        total_query_str += "&job_id=" + query_params["job_id"]["$oid"]

    # In the aggregation result, the _id field is the one that gets aggregated.
    if all([query_params["kernel"],
            query_params["kernel"] == query_params.get("_id", None)]):
        query_str += "&kernel=" + query_params["kernel"]
        total_query_str += "&kernel=" + query_params["kernel"]

    # Get the totals.
    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_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_boots",
            "resource": "count",
            "document": "boot",
            "query": query_str % query_params
        }
    )

    data, status, headers = backend.request_post(
        BACKEND_BATCH_URL,
        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
コード例 #11
0
ファイル: job.py プロジェクト: kernelci/kernelci-frontend
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
コード例 #12
0
def _get_boot_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_str = "status=%(status)s&job=%(job)s&mach=%(mach)s"
    total_query_str = "job=%(job)s&mach=%(mach)s" % query_params

    if query_params.get("job_id", None):
        query_str += "&job_id=" + query_params["job_id"]["$oid"]
        total_query_str += "&job_id=" + query_params["job_id"]["$oid"]

    # In the aggregation result, the _id field is the one that gets aggregated.
    if all([
            query_params["kernel"],
            query_params["kernel"] == query_params.get("_id", None)
    ]):
        query_str += "&kernel=" + query_params["kernel"]
        total_query_str += "&kernel=" + query_params["kernel"]

    # Get the totals.
    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_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_boots",
        "resource": "count",
        "document": "boot",
        "query": query_str % query_params
    })

    data, status, headers = backend.request_post(
        BACKEND_BATCH_URL,
        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