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 pickle | |
| 8 import zlib | |
| 9 | |
| 7 from google.appengine.ext import ndb | 10 from google.appengine.ext import ndb |
| 8 | 11 |
| 9 from model.versioned_config import VersionedConfig | 12 from model.versioned_config import VersionedConfig |
| 10 | 13 |
| 11 | 14 |
| 12 class CrashConfig(VersionedConfig): | 15 class CrashConfig(VersionedConfig): |
| 13 """Global configuration of settings for processing Chrome crashes.""" | 16 """Global configuration of settings for processing Chrome crashes.""" |
| 14 # Fracas-specific parameters. | 17 # Fracas-specific parameters. |
| 15 # { | 18 # { |
| 16 # "analysis_result_pubsub_topic": "projects/project-name/topics/name", | 19 # "analysis_result_pubsub_topic": "projects/project-name/topics/name", |
| 17 # "supported_platform_list_by_channel": { | 20 # "supported_platform_list_by_channel": { |
| 18 # "canary": ["win", "mac"], | 21 # "canary": ["win", "mac"], |
| 19 # }, | 22 # }, |
| 20 # } | 23 # } |
| 21 fracas = ndb.JsonProperty(indexed=False, default={}) | 24 fracas = ndb.JsonProperty(indexed=False, default={}) |
| 25 | |
| 26 ################## Settings shared by Fracas/Clusterfuzz. ################## | |
| 27 # Project classifier settings: | |
| 28 # { | |
| 29 # "host_directories": [ | |
| 30 # "src/chrome/browser/resources/", | |
| 31 # "src/chrome/test/data/layout_tests/", | |
| 32 # "src/media/", | |
| 33 # "src/sdch/", | |
| 34 # "src/testing/", | |
| 35 # "src/third_party/WebKit/", | |
| 36 # "src/third_party/", | |
| 37 # "src/tools/", | |
| 38 # "src/" | |
| 39 # ], | |
| 40 # # Where there is no dep_path found, use function and file_path makers to | |
| 41 # # map a Result or StackFrame to a project name. | |
| 42 # "function_marker_to_project_name": { | |
| 43 # "org.chromium": "chromium", | |
| 44 # "com.google.android.apps.chrome": "clank", | |
| 45 # "android.": "android_os", | |
| 46 # "com.android.": "android_os", | |
| 47 # }, | |
| 48 # "file_path_marker_to_project_name": { | |
| 49 # ("https___googleplex-android.googlesource." | |
| 50 # "com_a_platform_manifest.git/"): "android_os", | |
| 51 # "googleplex-android/": "android_os", | |
| 52 # }, | |
| 53 # | |
| 54 # # Number of frames on top to consider when deciding the crashed project. | |
| 55 # "top_n": 4, | |
| 56 # | |
| 57 # # The chromium project should always have the highest rank priority (0). | |
| 58 # # This dict assigns rank priorities to non chromium projects. | |
| 59 # "non_chromium_project_rank_priority" = { | |
| 60 # "clank": -1, | |
| 61 # "android_os": -2, | |
| 62 # "android_os_java": -2, | |
| 63 # "src_internal": -3, | |
| 64 # "others": -4, | |
| 65 # } | |
| 66 # } | |
| 67 project_classifier = ndb.JsonProperty(indexed=False, default={}) | |
| 68 | |
| 69 # Component classifier settings: | |
| 70 # { | |
| 71 # # Number of frames on top to consider when deciding the crashed | |
| 72 # #component. | |
| 73 # "top_n": 4, | |
| 74 # "path_function_component": [ | |
| 75 # (r"src/third_party/WebKit/Source/core/layout", , "Blink>Layout"), | |
| 76 # ... | |
| 77 # ] | |
| 78 # } | |
| 79 compressed_component_classifier = ndb.BlobProperty(indexed=False, | |
|
stgao
2016/05/21 00:54:03
For compress, an alternative is:
ndb.JsonProperty(
Sharu Jiang
2016/05/23 23:54:50
I found out there is a PickleProperty...
| |
| 80 default=None) | |
| 81 | |
| 82 @property | |
| 83 def component_classifier(self): | |
| 84 """Decompresses the compressed_component_classifier.""" | |
| 85 return ({} if self.compressed_component_classifier is None else | |
| 86 pickle.loads(zlib.decompress(self.compressed_component_classifier))) | |
| 87 | |
| 88 @property | |
| 89 def str_component_classifier(self): | |
| 90 """Converts component_classifier to str, since there are re objects in it. | |
| 91 | |
| 92 Note, this is intended to be called only by the CrashConfig HandleGet so as | |
| 93 to better display the current configuration. | |
| 94 """ | |
| 95 component_config = self.component_classifier | |
| 96 if not component_config: | |
| 97 return {} | |
| 98 | |
| 99 # Convert the pattern strings to re compiled objects. | |
| 100 path_function_component = [] | |
| 101 for path, function, component in component_config.get( | |
|
stgao
2016/05/21 00:54:03
Personally, it'd avoid this complexity.
I left a
stgao
2016/05/21 00:54:03
This is a little tricky, especially the code for t
Sharu Jiang
2016/05/23 23:54:50
I can move them to the same place, but it's not ne
| |
| 102 'path_function_component', []): | |
| 103 path_function_component.append([ | |
| 104 path.pattern, | |
| 105 function.pattern if function else "", | |
| 106 component]) | |
| 107 | |
| 108 component_config['path_function_component'] = path_function_component | |
| 109 | |
| 110 return component_config | |
| OLD | NEW |