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

Side by Side Diff: appengine/findit/waterfall/schedule_try_job_pipeline.py

Issue 1926473002: [Findit] Adding new fields to try job metadata and updating as soon as possible (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Addressing comments Created 4 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 from common.pipeline_wrapper import BasePipeline 5 from common.pipeline_wrapper import BasePipeline
6 from common.pipeline_wrapper import pipeline 6 from common.pipeline_wrapper import pipeline
7 from common.waterfall import buildbucket_client 7 from common.waterfall import buildbucket_client
8 from model.wf_try_job import WfTryJob 8 from model.wf_try_job import WfTryJob
9 from model.wf_try_job_data import WfTryJobData
9 from waterfall import buildbot 10 from waterfall import buildbot
10 from waterfall import waterfall_config 11 from waterfall import waterfall_config
11 from waterfall.try_job_type import TryJobType 12 from waterfall.try_job_type import TryJobType
12 13
13 14
14 class ScheduleTryJobPipeline(BasePipeline): 15 class ScheduleTryJobPipeline(BasePipeline):
15 """A pipeline for scheduling a new try job for current build.""" 16 """A pipeline for scheduling a new try job for current build."""
16 17
17 def _GetBuildProperties( 18 def _GetBuildProperties(
18 self, master_name, builder_name, build_number, good_revision, 19 self, master_name, builder_name, build_number, good_revision,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 56
56 try_job = buildbucket_client.TryJob( 57 try_job = buildbucket_client.TryJob(
57 tryserver_mastername, tryserver_buildername, None, properties, []) 58 tryserver_mastername, tryserver_buildername, None, properties, [])
58 error, build = buildbucket_client.TriggerTryJobs([try_job])[0] 59 error, build = buildbucket_client.TriggerTryJobs([try_job])[0]
59 60
60 if error: # pragma: no cover 61 if error: # pragma: no cover
61 raise pipeline.Retry( 62 raise pipeline.Retry(
62 'Error "%s" occurred. Reason: "%s"' % (error.message, error.reason)) 63 'Error "%s" occurred. Reason: "%s"' % (error.message, error.reason))
63 64
64 try_job_result = WfTryJob.Get(master_name, builder_name, build_number) 65 try_job_result = WfTryJob.Get(master_name, builder_name, build_number)
66 build_id = build.id
67
65 if try_job_type == TryJobType.COMPILE: 68 if try_job_type == TryJobType.COMPILE:
66 try_job_result.compile_results.append({'try_job_id': build.id}) 69 try_job_result.compile_results.append({'try_job_id': build_id})
67 else: 70 else:
68 try_job_result.test_results.append({'try_job_id': build.id}) 71 try_job_result.test_results.append({'try_job_id': build_id})
69 try_job_result.try_job_ids.append(build.id) 72 try_job_result.try_job_ids.append(build_id)
70 try_job_result.put() 73 try_job_result.put()
71 74
72 return build.id 75 # Create a corresponding WfTryJobData entity to capture as much metadata as
76 # early as possible.
77 assert build_id
stgao 2016/04/27 17:34:33 No need to assert here. If no error, build id will
lijeffrey 2016/04/27 22:21:03 Done.
78 try_job_data = WfTryJobData.Create(build_id)
79 try_job_data.master_name = master_name
80 try_job_data.builder_name = builder_name
81 try_job_data.build_number = build_number
82 try_job_data.try_job_type = try_job_type
83 try_job_data.has_compile_targets = bool(compile_targets)
84 try_job_data.has_heuristic_results = bool(suspected_revisions)
85 try_job_data.put()
86
87 return build_id
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698