Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3232)

Unified Diff: appengine/findit/model/crash/crash_config.py

Issue 1914113002: [Findit] Enable project classifier and component classifier (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: appengine/findit/model/crash/crash_config.py
diff --git a/appengine/findit/model/crash/crash_config.py b/appengine/findit/model/crash/crash_config.py
index 20e6c7a3558caa0a51d6cc4b5ecb29c9276b9ca7..8774b1004856fc30d5b49b67e5d23b28db370ac5 100644
--- a/appengine/findit/model/crash/crash_config.py
+++ b/appengine/findit/model/crash/crash_config.py
@@ -4,6 +4,8 @@
"""Findit for crash (ClusterFuzz & Fracas/Chromecrash) configuration."""
+import re
+
from google.appengine.ext import ndb
from model.versioned_config import VersionedConfig
@@ -11,6 +13,11 @@ from model.versioned_config import VersionedConfig
class CrashConfig(VersionedConfig):
"""Global configuration of settings for processing Chrome crashes."""
+
+ def __init__(self, *args, **kargs):
+ super(CrashConfig, self).__init__(*args, **kargs)
+ self.cached_component_classifier = None
+
# Fracas-specific parameters.
# {
# "analysis_result_pubsub_topic": "projects/project-name/topics/name",
@@ -19,3 +26,81 @@ class CrashConfig(VersionedConfig):
# },
# }
fracas = ndb.JsonProperty(indexed=False, default={})
+
+ ################## Settings shared by Fracas/Clusterfuzz. ##################
+ # Project classifier settings:
+ # {
+ # "host_directories": [
+ # "src/chrome/browser/resources/",
+ # "src/chrome/test/data/layout_tests/",
+ # "src/media/",
+ # "src/sdch/",
+ # "src/testing/",
+ # "src/third_party/WebKit/",
+ # "src/third_party/",
+ # "src/tools/",
+ # "src/"
+ # ],
+ # # Where there is no dep_path found, use function and file_path makers to
+ # # map a Result or StackFrame to a project name.
+ # "function_marker_to_project_name": {
+ # "org.chromium": "chromium",
+ # "com.google.android.apps.chrome": "clank",
+ # "android.": "android_os",
+ # "com.android.": "android_os",
+ # },
+ # "file_path_marker_to_project_name": {
+ # ("https___googleplex-android.googlesource."
+ # "com_a_platform_manifest.git/"): "android_os",
+ # "googleplex-android/": "android_os",
+ # },
+ #
+ # # Number of frames on top to consider when deciding the crashed project.
+ # "top_n": 4,
+ #
+ # # The chromium project should always have the highest rank priority (0).
+ # # This dict assigns rank priorities to non chromium projects.
+ # "non_chromium_project_rank_priority" = {
+ # "clank": -1,
+ # "android_os": -2,
+ # "android_os_java": -2,
+ # "src_internal": -3,
+ # "others": -4,
+ # }
+ # }
+ project_classifier = ndb.JsonProperty(indexed=False, default={})
+
+ # Component classifier settings:
+ # {
+ # # Number of frames on top to consider when deciding the crashed
+ # #component.
+ # "top_n": 4,
+ # "path_function_component": [
+ # [r"src/third_party/WebKit/Source/core/layout", , "Blink>Layout"],
+ # ...
+ # ]
+ # }
+ component_classifier = ndb.JsonProperty(indexed=False, default={},
+ compressed=True)
+
+ def ClearCache(self):
+ self.cached_component_classifier = None
+
+ @property
+ def compiled_component_classifier(self):
+ """Returns the component classifier with all re patterns compiled."""
+ if self.cached_component_classifier is None and self.component_classifier:
+ compiled_path_function_component = []
+ for path, function, component in self.component_classifier[
+ 'path_function_component']:
+ compiled_path_function_component.append(
+ [re.compile(path),
+ re.compile(function) if function else None,
+ component])
+
+ self.cached_component_classifier = {
+ 'top_n': self.component_classifier['top_n'],
+ 'path_function_component': compiled_path_function_component
+ }
+
+ return self.cached_component_classifier
« no previous file with comments | « appengine/findit/handlers/crash/crash_config.py ('k') | appengine/findit/model/crash/test/crash_config_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698