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

Side by Side Diff: appengine/findit/crash/findit_for_chromecrash.py

Issue 2608483002: Changed FindSuspects to take a Repository factory, rather than mutating it (Closed)
Patch Set: rebase Created 3 years, 11 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 unified diff | Download patch
OLDNEW
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 import logging 5 import logging
6 6
7 from google.appengine.ext import ndb 7 from google.appengine.ext import ndb
8 8
9 from common import appengine_util 9 from common import appengine_util
10 from crash import detect_regression_range 10 from crash import detect_regression_range
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 cls.__name__) 47 cls.__name__)
48 raise NotImplementedError() 48 raise NotImplementedError()
49 49
50 # TODO(http://crbug.com/659354): remove the dependency on CrashConfig 50 # TODO(http://crbug.com/659354): remove the dependency on CrashConfig
51 # entirely, by passing the relevant data as arguments to this constructor. 51 # entirely, by passing the relevant data as arguments to this constructor.
52 def __init__(self, repository): 52 def __init__(self, repository):
53 super(FinditForChromeCrash, self).__init__(repository) 53 super(FinditForChromeCrash, self).__init__(repository)
54 component_classifier_config = CrashConfig.Get().component_classifier 54 component_classifier_config = CrashConfig.Get().component_classifier
55 55
56 self._stacktrace_parser = ChromeCrashParser() 56 self._stacktrace_parser = ChromeCrashParser()
57
58 # TODO(crbug.com/677224): should replace this with an actual factory.
59 def MutateTheRepo(dep_url): # pragma: no cover
60 """A factory function for returning ``Repository`` objects.
61
62 The current definition captures the functionality of before
63 we factored out this factory method. That is, it's not really a
64 "factory" but rather mutates the main repo object in place. In
65 the future this should be changed to do the right thing instead.
66 """
67 repository.repo_url = dep_url
68 return repository
69
57 # The top_n is the number of components we should return as 70 # The top_n is the number of components we should return as
58 # components suggestion results. 71 # components suggestion results.
59 self._predator = Predator( 72 self._predator = Predator(
60 cl_classifier = ChangelistClassifier(repository = repository), 73 cl_classifier = ChangelistClassifier(repository, MutateTheRepo),
61 component_classifier = ComponentClassifier( 74 component_classifier = ComponentClassifier(
62 [Component(component_name, path_regex, function_regex) 75 [Component(component_name, path_regex, function_regex)
63 for path_regex, function_regex, component_name 76 for path_regex, function_regex, component_name
64 in component_classifier_config['path_function_component']], 77 in component_classifier_config['path_function_component']],
65 component_classifier_config['top_n']), 78 component_classifier_config['top_n']),
66 project_classifier = ProjectClassifier()) 79 project_classifier = ProjectClassifier())
67 80
68 def _InitializeAnalysis(self, model, crash_data): 81 def _InitializeAnalysis(self, model, crash_data):
69 super(FinditForChromeCrash, self)._InitializeAnalysis(model, crash_data) 82 super(FinditForChromeCrash, self)._InitializeAnalysis(model, crash_data)
70 # TODO(wrengr): see Note#1 83 # TODO(wrengr): see Note#1
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 179
167 def GetAnalysis(self, crash_identifiers): 180 def GetAnalysis(self, crash_identifiers):
168 # TODO: inline FracasCrashAnalysis.Get stuff here. 181 # TODO: inline FracasCrashAnalysis.Get stuff here.
169 return FracasCrashAnalysis.Get(crash_identifiers) 182 return FracasCrashAnalysis.Get(crash_identifiers)
170 183
171 def ProcessResultForPublishing(self, result, key): 184 def ProcessResultForPublishing(self, result, key):
172 """Fracas specific processing of result data for publishing.""" 185 """Fracas specific processing of result data for publishing."""
173 result['feedback_url'] = _FRACAS_FEEDBACK_URL_TEMPLATE % ( 186 result['feedback_url'] = _FRACAS_FEEDBACK_URL_TEMPLATE % (
174 appengine_util.GetDefaultVersionHostname(), key) 187 appengine_util.GetDefaultVersionHostname(), key)
175 return result 188 return result
OLDNEW
« no previous file with comments | « appengine/findit/crash/changelist_classifier.py ('k') | appengine/findit/crash/loglinear/changelist_classifier.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698