Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reapply: lazy load revert #824

Merged
merged 5 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions backend/kernelCI_app/helpers/treeDetails.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
)
from kernelCI_app.cache import getQueryCache, setQueryCache
from kernelCI_app.utils import is_boot
from kernelCI_app.constants.hardwareDetails import STATUS_FAILED_VALUE
from django.db import connection


Expand Down Expand Up @@ -510,3 +511,43 @@ def process_boots_summary(instance, row_data):
] += 1
else:
instance.bootEnvironmentMisc[test_platform][test_status] += 1


def process_filters(instance, row_data: dict) -> None:
if row_data["build_id"] is not None:
instance.global_configs.add(row_data["build_config_name"])
instance.global_architectures.add(row_data["build_architecture"])
instance.global_compilers.add(row_data["build_config_name"])

issue_id = row_data["issue_id"]
issue_version = row_data["issue_version"]
incident_test_id = row_data["incident_test_id"]
build_valid = row_data["build_valid"]

if row_data["build_id"] is not None:
build_issue_id, is_build_issue = should_increment_build_issue(
issue_id=issue_id,
incident_test_id=incident_test_id,
build_valid=build_valid,
)

if build_issue_id is not None and issue_version is not None and is_build_issue:
instance.unfiltered_build_issues.add(build_issue_id)
elif build_valid is False:
instance.unfiltered_build_issues.add(UNKNOWN_STRING)

if row_data["test_id"] is not None:
test_issue_id, is_test_issue = should_increment_test_issue(
issue_id=issue_id,
incident_test_id=incident_test_id,
)

if is_boot(row_data["test_path"]):
issue_set = instance.unfiltered_boot_issues
else:
issue_set = instance.unfiltered_test_issues

if test_issue_id is not None and issue_version is not None and is_test_issue:
issue_set.add(test_issue_id)
elif row_data["test_status"] == STATUS_FAILED_VALUE:
issue_set.add(UNKNOWN_STRING)
27 changes: 23 additions & 4 deletions backend/kernelCI_app/typeModels/treeDetails.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Dict, List, Optional, Set
from typing import Dict, List, Optional

from kernelCI_app.typeModels.commonDetails import (
Summary,
Expand Down Expand Up @@ -28,14 +28,33 @@ class TestSummary(BaseModel):
failed_platforms: List[str]


class TreeSummary(Summary):
hardware: Optional[Set[str]]
class TreeCommon(BaseModel):
hardware: Optional[List[str]]
tree_url: Optional[str]
git_commit_tags: Optional[List[str]]


class TreeGlobalFilters(BaseModel):
configs: List[str]
architectures: List[str]
compilers: List[str]


class TreeLocalFilters(BaseModel):
issues: List[str]


class TreeFilters(BaseModel):
all: TreeGlobalFilters
builds: TreeLocalFilters
boots: TreeLocalFilters
tests: TreeLocalFilters


class SummaryResponse(BaseModel):
summary: TreeSummary
common: TreeCommon
summary: Summary
filters: TreeFilters


class BootResponse(BaseModel):
Expand Down
35 changes: 31 additions & 4 deletions backend/kernelCI_app/views/treeDetailsSummaryView.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
process_builds_issue,
process_test_summary,
process_tests_issue,
process_filters,
)
from kernelCI_app.typeModels.treeDetails import SummaryResponse
from kernelCI_app.utils import (
Expand Down Expand Up @@ -67,6 +68,13 @@ def __init__(self):
self.tree_url = ""
self.git_commit_tags = []

self.global_configs = set()
self.global_architectures = set()
self.global_compilers = set()
self.unfiltered_test_issues = set()
self.unfiltered_boot_issues = set()
self.unfiltered_build_issues = set()

def _process_boots_test(self, row_data):
test_id = row_data["test_id"]

Expand Down Expand Up @@ -120,6 +128,7 @@ def _sanitize_rows(self, rows):
call_based_on_compatible_and_misc_platform(row_data, self.hardwareUsed.add)

process_tree_url(self, row_data)
process_filters(self, row_data)

is_record_filter_out = decide_if_is_full_row_filtered_out(self, row_data)

Expand Down Expand Up @@ -158,6 +167,11 @@ def get(self, request, commit_hash: str | None):
self._sanitize_rows(rows)

response = {
"common": {
"tree_url": self.tree_url,
"hardware": list(self.hardwareUsed),
"git_commit_tags": self.git_commit_tags,
},
"summary": {
"builds": {
"status": self.build_summary["builds"],
Expand Down Expand Up @@ -188,10 +202,23 @@ def get(self, request, commit_hash: str | None):
"fail_reasons": self.testFailReasons,
"failed_platforms": list(self.testPlatformsWithErrors),
},
"hardware": list(self.hardwareUsed),
"tree_url": self.tree_url,
"git_commit_tags": self.git_commit_tags,
}
},
"filters": {
"all": {
"configs": list(self.global_configs),
"architectures": list(self.global_architectures),
"compilers": list(self.global_compilers),
},
"builds": {
"issues": list(self.unfiltered_build_issues),
},
"boots": {
"issues": list(self.unfiltered_boot_issues),
},
"tests": {
"issues": list(self.unfiltered_test_issues),
},
},
}

try:
Expand Down
27 changes: 27 additions & 0 deletions backend/kernelCI_app/views/treeDetailsView.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
process_builds_issue,
process_test_summary,
process_tests_issue,
process_filters,
)
from kernelCI_app.utils import (
Issue,
Expand Down Expand Up @@ -72,6 +73,13 @@ def __init__(self):
self.tree_url = ""
self.git_commit_tags = []

self.global_configs = set()
self.global_architectures = set()
self.global_compilers = set()
self.unfiltered_test_issues = set()
self.unfiltered_boot_issues = set()
self.unfiltered_build_issues = set()

def _process_boots_test(self, row_data):
test_id = row_data["test_id"]
history_item = row_data["history_item"]
Expand Down Expand Up @@ -129,6 +137,7 @@ def _sanitize_rows(self, rows):
call_based_on_compatible_and_misc_platform(row_data, self.hardwareUsed.add)

process_tree_url(self, row_data)
process_filters(self, row_data)

is_record_filter_out = decide_if_is_full_row_filtered_out(self, row_data)

Expand Down Expand Up @@ -198,10 +207,28 @@ def get(self, request, commit_hash: str | None):
"fail_reasons": self.testFailReasons,
"failed_platforms": list(self.testPlatformsWithErrors),
},
},
"common": {
"hardware": list(self.hardwareUsed),
"tree_url": self.tree_url,
"git_commit_tags": self.git_commit_tags,
},
"filters": {
"all": {
"configs": list(self.global_configs),
"architectures": list(self.global_architectures),
"compilers": list(self.global_compilers),
},
"builds": {
"issues": list(self.unfiltered_build_issues),
},
"boots": {
"issues": list(self.unfiltered_boot_issues),
},
"tests": {
"issues": list(self.unfiltered_test_issues),
},
},
},
safe=False,
)
87 changes: 74 additions & 13 deletions backend/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -663,12 +663,32 @@ components:
- platform
title: Misc
type: object
Summary:
properties:
builds:
$ref: '#/components/schemas/BuildSummary'
boots:
$ref: '#/components/schemas/TestSummary'
tests:
$ref: '#/components/schemas/TestSummary'
required:
- builds
- boots
- tests
title: Summary
type: object
SummaryResponse:
properties:
common:
$ref: '#/components/schemas/TreeCommon'
summary:
$ref: '#/components/schemas/TreeSummary'
$ref: '#/components/schemas/Summary'
filters:
$ref: '#/components/schemas/TreeFilters'
required:
- common
- summary
- filters
title: SummaryResponse
type: object
TestArchSummaryItem:
Expand Down Expand Up @@ -945,20 +965,13 @@ components:
- selected_commit_status
title: Tree
type: object
TreeSummary:
TreeCommon:
properties:
builds:
$ref: '#/components/schemas/BuildSummary'
boots:
$ref: '#/components/schemas/TestSummary'
tests:
$ref: '#/components/schemas/TestSummary'
hardware:
anyOf:
- items:
type: string
type: array
uniqueItems: true
- type: 'null'
title: Hardware
tree_url:
Expand All @@ -974,13 +987,61 @@ components:
- type: 'null'
title: Git Commit Tags
required:
- builds
- boots
- tests
- hardware
- tree_url
- git_commit_tags
title: TreeSummary
title: TreeCommon
type: object
TreeFilters:
properties:
all:
$ref: '#/components/schemas/TreeGlobalFilters'
builds:
$ref: '#/components/schemas/TreeLocalFilters'
boots:
$ref: '#/components/schemas/TreeLocalFilters'
tests:
$ref: '#/components/schemas/TreeLocalFilters'
required:
- all
- builds
- boots
- tests
title: TreeFilters
type: object
TreeGlobalFilters:
properties:
configs:
items:
type: string
title: Configs
type: array
architectures:
items:
type: string
title: Architectures
type: array
compilers:
items:
type: string
title: Compilers
type: array
required:
- configs
- architectures
- compilers
title: TreeGlobalFilters
type: object
TreeLocalFilters:
properties:
issues:
items:
type: string
title: Issues
type: array
required:
- issues
title: TreeLocalFilters
type: object
securitySchemes:
basicAuth:
Expand Down
Loading
Loading