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

Unified Diff: appengine/findit/handlers/crash/crash_handler.py

Issue 2663063007: [Predator] Switch from anonymous dict to CrashData. (Closed)
Patch Set: Rebase. Created 3 years, 10 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/handlers/crash/crash_handler.py
diff --git a/appengine/findit/handlers/crash/crash_handler.py b/appengine/findit/handlers/crash/crash_handler.py
index b604889b8cd0902ef147dfef870ae8741c856f4a..5a7854e738bb8b0f44f1327e5202cc6785c77b1e 100644
--- a/appengine/findit/handlers/crash/crash_handler.py
+++ b/appengine/findit/handlers/crash/crash_handler.py
@@ -11,9 +11,9 @@ from common import appengine_util
from common.base_handler import BaseHandler
from common.base_handler import Permission
from crash import crash_pipeline
-from crash.crash_report import CrashReport
from gae_libs.gitiles.cached_gitiles_repository import CachedGitilesRepository
from gae_libs.http.http_client_appengine import HttpClientAppengine
+from model.crash.crash_config import CrashConfig
class CrashHandler(BaseHandler):
@@ -131,29 +131,25 @@ def ScheduleNewAnalysis(crash_data):
client_id = crash_data['client_id']
# N.B., must call FinditForClientID indirectly, for mock testing.
findit_client = crash_pipeline.FinditForClientID(client_id,
- CachedGitilesRepository.Factory(HttpClientAppengine()))
-
- # Check policy and modify the crash_data as needed.
- crash_data = findit_client.CheckPolicy(crash_data)
- if crash_data is None:
- return False
+ CachedGitilesRepository.Factory(HttpClientAppengine()), CrashConfig.Get())
+ crash_buffer = findit_client.GetCrashBuffer(crash_data)
# Detect the regression range, and decide if we actually need to
# run a new anlaysis or not.
- if not findit_client._NeedsNewAnalysis(crash_data):
+ if not findit_client.NeedsNewAnalysis(crash_buffer):
return False
- crash_identifiers = crash_data['crash_identifiers']
- # N.B., we cannot pass ``self`` directly to the _pipeline_cls, because
- # it is not JSON-serializable (and there's no way to make it such,
+ # N.B., we cannot pass ``findit_client`` directly to the _pipeline_cls,
+ # because it is not JSON-serializable (and there's no way to make it such,
# since JSON-serializability is defined by JSON-encoders rather than
# as methods on the objects being encoded).
- pipeline = crash_pipeline.CrashWrapperPipeline(client_id, crash_identifiers)
+ pipeline = crash_pipeline.CrashWrapperPipeline(client_id,
+ crash_buffer.identifiers)
# Attribute defined outside __init__ - pylint: disable=W0201
pipeline.target = appengine_util.GetTargetNameForModule(
constants.CRASH_BACKEND[client_id])
queue_name = constants.CRASH_ANALYSIS_QUEUE[client_id]
pipeline.start(queue_name=queue_name)
logging.info('New %s analysis is scheduled for %s', client_id,
- repr(crash_identifiers))
+ repr(crash_buffer.identifiers))
return True

Powered by Google App Engine
This is Rietveld 408576698