Chromium Code Reviews| 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.""" |
| 14 # Fracas-specific parameters. | 16 # Fracas-specific parameters. |
| 15 # { | 17 # { |
| 16 # "analysis_result_pubsub_topic": "projects/project-name/topics/name", | 18 # "analysis_result_pubsub_topic": "projects/project-name/topics/name", |
| 17 # "supported_platform_list_by_channel": { | 19 # "supported_platform_list_by_channel": { |
| 18 # "canary": ["win", "mac"], | 20 # "canary": ["win", "mac"], |
| 19 # }, | 21 # }, |
| 20 # } | 22 # } |
| 21 fracas = ndb.JsonProperty(indexed=False, default={}) | 23 fracas = ndb.JsonProperty(indexed=False, default={}) |
| 24 | |
| 25 ################## Settings shared by Fracas/Clusterfuzz. ################## | |
| 26 # Project classifier settings: | |
| 27 # { | |
| 28 # "host_directories": [ | |
| 29 # "src/chrome/browser/resources/", | |
| 30 # "src/chrome/test/data/layout_tests/", | |
| 31 # "src/media/", | |
| 32 # "src/sdch/", | |
| 33 # "src/testing/", | |
| 34 # "src/third_party/WebKit/", | |
| 35 # "src/third_party/", | |
| 36 # "src/tools/", | |
| 37 # "src/" | |
| 38 # ], | |
| 39 # # Where there is no dep_path found, use function and file_path makers to | |
| 40 # # map a Result or StackFrame to a project name. | |
| 41 # "function_marker_to_project_name": { | |
| 42 # "org.chromium": "chromium", | |
| 43 # "com.google.android.apps.chrome": "clank", | |
| 44 # "android.": "android_os", | |
| 45 # "com.android.": "android_os", | |
| 46 # }, | |
| 47 # "file_path_marker_to_project_name": { | |
| 48 # ("https___googleplex-android.googlesource." | |
| 49 # "com_a_platform_manifest.git/"): "android_os", | |
| 50 # "googleplex-android/": "android_os", | |
| 51 # }, | |
| 52 # | |
| 53 # # Number of frames on top to consider when deciding the crashed project. | |
| 54 # "top_n": 4, | |
| 55 # | |
| 56 # # The chromium project should always have the highest rank priority (0). | |
| 57 # # This dict assigns rank priorities to non chromium projects. | |
| 58 # "non_chromium_project_rank_priority" = { | |
| 59 # "clank": -1, | |
| 60 # "android_os": -2, | |
| 61 # "android_os_java": -2, | |
| 62 # "src_internal": -3, | |
| 63 # "others": -4, | |
| 64 # } | |
| 65 # } | |
| 66 project_classifier = ndb.JsonProperty(indexed=False, default={}) | |
| 67 | |
| 68 # Component classifier settings: | |
| 69 # { | |
| 70 # # Number of frames on top to consider when deciding the crashed | |
| 71 # #component. | |
| 72 # "top_n": 4, | |
| 73 # "path_function_component": [ | |
| 74 # [r"src/third_party/WebKit/Source/core/layout", , "Blink>Layout"], | |
| 75 # ... | |
| 76 # ] | |
| 77 # } | |
| 78 component_classifier = ndb.JsonProperty(indexed=False, default={}, | |
| 79 compressed=True) | |
| 80 | |
| 81 # cached component classifer with all re patterns compiled. | |
| 82 cached_component_classifier = ndb.PickleProperty(indexed=False, default=None, | |
|
stgao
2016/05/24 00:10:58
Do we plan to save this in NDB? If not, let's not
Sharu Jiang
2016/05/24 22:22:44
Done.
| |
| 83 compressed=True) | |
| 84 | |
| 85 def ClearCache(self): | |
| 86 self.cached_component_classifier = None | |
| 87 | |
| 88 @property | |
| 89 def compiled_component_classifier(self): | |
| 90 """Returns the component classifier with all re patterns compiled.""" | |
| 91 if self.cached_component_classifier is None: | |
| 92 compiled_path_function_component = [] | |
| 93 for path, function, component in self.component_classifier[ | |
| 94 'path_function_component']: | |
| 95 compiled_path_function_component.append( | |
| 96 [re.compile(path), re.compile(function), component]) | |
| 97 | |
| 98 self.cached_component_classifier = { | |
| 99 'top_n': self.component_classifier['top_n'], | |
| 100 'path_function_component': compiled_path_function_component | |
| 101 } | |
| 102 | |
| 103 return self.cached_component_classifier | |
| OLD | NEW |