| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Findit for crash (ClusterFuzz & Fracas/Chromecrash) configuration.""" | 5 """Findit for crash (ClusterFuzz & Fracas/Chromecrash) configuration.""" |
| 6 | 6 |
| 7 import re |
| 8 |
| 7 from google.appengine.ext import ndb | 9 from google.appengine.ext import ndb |
| 8 | 10 |
| 9 from model.versioned_config import VersionedConfig | 11 from model.versioned_config import VersionedConfig |
| 10 | 12 |
| 11 | 13 |
| 12 class CrashConfig(VersionedConfig): | 14 class CrashConfig(VersionedConfig): |
| 13 """Global configuration of settings for processing Chrome crashes.""" | 15 """Global configuration of settings for processing Chrome crashes.""" |
| 16 |
| 17 def __init__(self, *args, **kargs): |
| 18 super(CrashConfig, self).__init__(*args, **kargs) |
| 19 self.cached_component_classifier = None |
| 20 |
| 14 # Fracas-specific parameters. | 21 # Fracas-specific parameters. |
| 15 # { | 22 # { |
| 16 # "analysis_result_pubsub_topic": "projects/project-name/topics/name", | 23 # "analysis_result_pubsub_topic": "projects/project-name/topics/name", |
| 17 # "supported_platform_list_by_channel": { | 24 # "supported_platform_list_by_channel": { |
| 18 # "canary": ["win", "mac"], | 25 # "canary": ["win", "mac"], |
| 19 # }, | 26 # }, |
| 20 # } | 27 # } |
| 21 fracas = ndb.JsonProperty(indexed=False, default={}) | 28 fracas = ndb.JsonProperty(indexed=False, default={}) |
| 29 |
| 30 ################## Settings shared by Fracas/Clusterfuzz. ################## |
| 31 # Project classifier settings: |
| 32 # { |
| 33 # "host_directories": [ |
| 34 # "src/chrome/browser/resources/", |
| 35 # "src/chrome/test/data/layout_tests/", |
| 36 # "src/media/", |
| 37 # "src/sdch/", |
| 38 # "src/testing/", |
| 39 # "src/third_party/WebKit/", |
| 40 # "src/third_party/", |
| 41 # "src/tools/", |
| 42 # "src/" |
| 43 # ], |
| 44 # # Where there is no dep_path found, use function and file_path makers to |
| 45 # # map a Result or StackFrame to a project name. |
| 46 # "function_marker_to_project_name": { |
| 47 # "org.chromium": "chromium", |
| 48 # "com.google.android.apps.chrome": "clank", |
| 49 # "android.": "android_os", |
| 50 # "com.android.": "android_os", |
| 51 # }, |
| 52 # "file_path_marker_to_project_name": { |
| 53 # ("https___googleplex-android.googlesource." |
| 54 # "com_a_platform_manifest.git/"): "android_os", |
| 55 # "googleplex-android/": "android_os", |
| 56 # }, |
| 57 # |
| 58 # # Number of frames on top to consider when deciding the crashed project. |
| 59 # "top_n": 4, |
| 60 # |
| 61 # # The chromium project should always have the highest rank priority (0). |
| 62 # # This dict assigns rank priorities to non chromium projects. |
| 63 # "non_chromium_project_rank_priority" = { |
| 64 # "clank": -1, |
| 65 # "android_os": -2, |
| 66 # "android_os_java": -2, |
| 67 # "src_internal": -3, |
| 68 # "others": -4, |
| 69 # } |
| 70 # } |
| 71 project_classifier = ndb.JsonProperty(indexed=False, default={}) |
| 72 |
| 73 # Component classifier settings: |
| 74 # { |
| 75 # # Number of frames on top to consider when deciding the crashed |
| 76 # #component. |
| 77 # "top_n": 4, |
| 78 # "path_function_component": [ |
| 79 # [r"src/third_party/WebKit/Source/core/layout", , "Blink>Layout"], |
| 80 # ... |
| 81 # ] |
| 82 # } |
| 83 component_classifier = ndb.JsonProperty(indexed=False, default={}, |
| 84 compressed=True) |
| 85 |
| 86 def ClearCache(self): |
| 87 self.cached_component_classifier = None |
| 88 |
| 89 @property |
| 90 def compiled_component_classifier(self): |
| 91 """Returns the component classifier with all re patterns compiled.""" |
| 92 if self.cached_component_classifier is None and self.component_classifier: |
| 93 compiled_path_function_component = [] |
| 94 for path, function, component in self.component_classifier[ |
| 95 'path_function_component']: |
| 96 compiled_path_function_component.append( |
| 97 [re.compile(path), |
| 98 re.compile(function) if function else None, |
| 99 component]) |
| 100 |
| 101 self.cached_component_classifier = { |
| 102 'top_n': self.component_classifier['top_n'], |
| 103 'path_function_component': compiled_path_function_component |
| 104 } |
| 105 |
| 106 return self.cached_component_classifier |
| OLD | NEW |