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

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

Issue 1667383002: [Findit] Adding master_name, builder_name, and try_job_type to try_job_data (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Addressing comments and rebase Created 4 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 unified diff | Download patch
« no previous file with comments | « appengine/findit/model/wf_try_job_data.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 datetime import datetime 5 from datetime import datetime
6 import time 6 import time
7 7
8 from common import buildbucket_client 8 from common import buildbucket_client
9 from common.buildbucket_client import BuildbucketBuild 9 from common.buildbucket_client import BuildbucketBuild
10 from model import wf_analysis_status 10 from model import wf_analysis_status
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 # Arguments number differs from overridden method - pylint: disable=W0221 92 # Arguments number differs from overridden method - pylint: disable=W0221
93 # TODO(chanli): Handle try job for test failures later. 93 # TODO(chanli): Handle try job for test failures later.
94 def run( 94 def run(
95 self, master_name, builder_name, build_number, try_job_type, try_job_id): 95 self, master_name, builder_name, build_number, try_job_type, try_job_id):
96 assert try_job_id 96 assert try_job_id
97 97
98 timeout_hours = 5 98 timeout_hours = 5
99 deadline = time.time() + timeout_hours * 60 * 60 99 deadline = time.time() + timeout_hours * 60 * 60
100 try_job_data = (WfTryJobData.Get(try_job_id) or 100 try_job_data = (WfTryJobData.Get(try_job_id) or
101 WfTryJobData.Create(try_job_id)) 101 WfTryJobData.Create(try_job_id))
102 try_job_data.master_name = master_name
103 try_job_data.builder_name = builder_name
104 try_job_data.try_job_type = try_job_type
102 105
103 already_set_started = False 106 already_set_started = False
104 start_time = None 107 start_time = None
105 while True: 108 while True:
106 error, build = buildbucket_client.GetTryJobs([try_job_id])[0] 109 error, build = buildbucket_client.GetTryJobs([try_job_id])[0]
107 if error: # pragma: no cover 110 if error: # pragma: no cover
108 self._UpdateTryJobMetadataForBuildError(try_job_data, error) 111 self._UpdateTryJobMetadataForBuildError(try_job_data, error)
109 raise pipeline.Retry( 112 raise pipeline.Retry(
110 'Error "%s" occurred. Reason: "%s"' % (error.message, error.reason)) 113 'Error "%s" occurred. Reason: "%s"' % (error.message, error.reason))
111 elif build.status == BuildbucketBuild.COMPLETED: 114 elif build.status == BuildbucketBuild.COMPLETED:
(...skipping 19 matching lines...) Expand all
131 if time.time() > deadline: # pragma: no cover 134 if time.time() > deadline: # pragma: no cover
132 try_job_result = WfTryJob.Get(master_name, builder_name, build_number) 135 try_job_result = WfTryJob.Get(master_name, builder_name, build_number)
133 try_job_result.status = wf_analysis_status.ERROR 136 try_job_result.status = wf_analysis_status.ERROR
134 try_job_result.put() 137 try_job_result.put()
135 self._UpdateTryJobMetadataForCompletedBuild( 138 self._UpdateTryJobMetadataForCompletedBuild(
136 try_job_data, build, start_time, timed_out=True) 139 try_job_data, build, start_time, timed_out=True)
137 # Explicitly abort the whole pipeline. 140 # Explicitly abort the whole pipeline.
138 raise pipeline.Abort( 141 raise pipeline.Abort(
139 'Try job %s timed out after %d hours.' % ( 142 'Try job %s timed out after %d hours.' % (
140 try_job_id, timeout_hours)) 143 try_job_id, timeout_hours))
OLDNEW
« no previous file with comments | « appengine/findit/model/wf_try_job_data.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698