bugbug/scripts/check.py

41 строка
901 B
Python
Исходник Обычный вид История

Add basic check method and check script (#341) * Add basic check method and check script * Ensure the check of component will correctly use super result * Add required infra to schedule model checks * Add scheduling bits for the model checks * Remove the filtering on classification * Extract counting bugs to a new function in bugzilla.py * Also checks conflated components * Fix new hook id * Call bugzilla with the count_only param to speed up the check * Fix the new hook scope to match the hook id * Fix component model check after previous refactoring * Fix component model check method * Use a bugzilla report for even faster component model check * Clarify get_product_component_count docstring We are already filtering out full component with 0 bugs * Update conflated components mapping check A conflated component could also be part of the conflated components mapping * Distinguish between non-existing full components and empty full components * Remove the filter on resolution and unnecessary url params * Update component check method Keep checks as separate as possible for clarity, we could merge them or makes them faster later * Generate dynamically the CSV report url * Fix Docker image name the hook * Implement component check number 5 Get the meaningful components for the last 6 months * Handle reviews comments * Remove extraneous print * Removes TODO * Use a different threshold ration when checking for new meaningful components As we are only checking new bugs for 6 months, adjust the threshold ration to be less sensitive to occasional burst ob bugs for q given component. * Reduce the threshold ratio As we check on a disjoint time window, reduce the chance of false positives * Handle review nits * Fix last nits
2019-05-10 13:20:23 +03:00
# -*- coding: utf-8 -*-
import argparse
import sys
from logging import INFO, basicConfig, getLogger
from bugbug.utils import download_and_load_model
Add basic check method and check script (#341) * Add basic check method and check script * Ensure the check of component will correctly use super result * Add required infra to schedule model checks * Add scheduling bits for the model checks * Remove the filtering on classification * Extract counting bugs to a new function in bugzilla.py * Also checks conflated components * Fix new hook id * Call bugzilla with the count_only param to speed up the check * Fix the new hook scope to match the hook id * Fix component model check after previous refactoring * Fix component model check method * Use a bugzilla report for even faster component model check * Clarify get_product_component_count docstring We are already filtering out full component with 0 bugs * Update conflated components mapping check A conflated component could also be part of the conflated components mapping * Distinguish between non-existing full components and empty full components * Remove the filter on resolution and unnecessary url params * Update component check method Keep checks as separate as possible for clarity, we could merge them or makes them faster later * Generate dynamically the CSV report url * Fix Docker image name the hook * Implement component check number 5 Get the meaningful components for the last 6 months * Handle reviews comments * Remove extraneous print * Removes TODO * Use a different threshold ration when checking for new meaningful components As we are only checking new bugs for 6 months, adjust the threshold ration to be less sensitive to occasional burst ob bugs for q given component. * Reduce the threshold ratio As we check on a disjoint time window, reduce the chance of false positives * Handle review nits * Fix last nits
2019-05-10 13:20:23 +03:00
basicConfig(level=INFO)
logger = getLogger(__name__)
class ModelChecker:
def go(self, model_name):
# Load the model
model = download_and_load_model(model_name)
Add basic check method and check script (#341) * Add basic check method and check script * Ensure the check of component will correctly use super result * Add required infra to schedule model checks * Add scheduling bits for the model checks * Remove the filtering on classification * Extract counting bugs to a new function in bugzilla.py * Also checks conflated components * Fix new hook id * Call bugzilla with the count_only param to speed up the check * Fix the new hook scope to match the hook id * Fix component model check after previous refactoring * Fix component model check method * Use a bugzilla report for even faster component model check * Clarify get_product_component_count docstring We are already filtering out full component with 0 bugs * Update conflated components mapping check A conflated component could also be part of the conflated components mapping * Distinguish between non-existing full components and empty full components * Remove the filter on resolution and unnecessary url params * Update component check method Keep checks as separate as possible for clarity, we could merge them or makes them faster later * Generate dynamically the CSV report url * Fix Docker image name the hook * Implement component check number 5 Get the meaningful components for the last 6 months * Handle reviews comments * Remove extraneous print * Removes TODO * Use a different threshold ration when checking for new meaningful components As we are only checking new bugs for 6 months, adjust the threshold ration to be less sensitive to occasional burst ob bugs for q given component. * Reduce the threshold ratio As we check on a disjoint time window, reduce the chance of false positives * Handle review nits * Fix last nits
2019-05-10 13:20:23 +03:00
# Then call the check method of the model
success = model.check()
if not success:
msg = f"Check of model {model.__class__!r} failed, check the output for reasons why"
Add basic check method and check script (#341) * Add basic check method and check script * Ensure the check of component will correctly use super result * Add required infra to schedule model checks * Add scheduling bits for the model checks * Remove the filtering on classification * Extract counting bugs to a new function in bugzilla.py * Also checks conflated components * Fix new hook id * Call bugzilla with the count_only param to speed up the check * Fix the new hook scope to match the hook id * Fix component model check after previous refactoring * Fix component model check method * Use a bugzilla report for even faster component model check * Clarify get_product_component_count docstring We are already filtering out full component with 0 bugs * Update conflated components mapping check A conflated component could also be part of the conflated components mapping * Distinguish between non-existing full components and empty full components * Remove the filter on resolution and unnecessary url params * Update component check method Keep checks as separate as possible for clarity, we could merge them or makes them faster later * Generate dynamically the CSV report url * Fix Docker image name the hook * Implement component check number 5 Get the meaningful components for the last 6 months * Handle reviews comments * Remove extraneous print * Removes TODO * Use a different threshold ration when checking for new meaningful components As we are only checking new bugs for 6 months, adjust the threshold ration to be less sensitive to occasional burst ob bugs for q given component. * Reduce the threshold ratio As we check on a disjoint time window, reduce the chance of false positives * Handle review nits * Fix last nits
2019-05-10 13:20:23 +03:00
logger.warning(msg)
sys.exit(1)
def main():
description = "Check the models"
parser = argparse.ArgumentParser(description=description)
parser.add_argument("model", help="Which model to check.")
args = parser.parse_args()
checker = ModelChecker()
checker.go(args.model)
if __name__ == "__main__":
main()