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

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

Issue 1935193002: [Findit] Update try-job result in a transaction and fix bugs in unittests. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Fix nit. Created 4 years, 7 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 datetime import datetime 5 from datetime import datetime
6 import json 6 import json
7 import time 7 import time
8 8
9 from google.appengine.ext import ndb
10
9 from common.pipeline_wrapper import BasePipeline 11 from common.pipeline_wrapper import BasePipeline
10 from common.pipeline_wrapper import pipeline 12 from common.pipeline_wrapper import pipeline
11 from common.waterfall import buildbucket_client 13 from common.waterfall import buildbucket_client
12 from common.waterfall import try_job_error 14 from common.waterfall import try_job_error
13 from common.waterfall.buildbucket_client import BuildbucketBuild 15 from common.waterfall.buildbucket_client import BuildbucketBuild
14 from model import analysis_status 16 from model import analysis_status
15 from model.wf_try_job import WfTryJob 17 from model.wf_try_job import WfTryJob
16 from model.wf_try_job_data import WfTryJobData 18 from model.wf_try_job_data import WfTryJobData
17 from waterfall import waterfall_config 19 from waterfall import waterfall_config
18 from waterfall.try_job_type import TryJobType 20 from waterfall.try_job_type import TryJobType
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 132
131 error_dict, error_code = MonitorTryJobPipeline._GetError( 133 error_dict, error_code = MonitorTryJobPipeline._GetError(
132 buildbucket_response, buildbucket_error, timed_out) 134 buildbucket_response, buildbucket_error, timed_out)
133 135
134 if error_dict: 136 if error_dict:
135 try_job_data.error = error_dict 137 try_job_data.error = error_dict
136 try_job_data.error_code = error_code 138 try_job_data.error_code = error_code
137 139
138 try_job_data.put() 140 try_job_data.put()
139 141
142 @ndb.transactional
140 def _UpdateTryJobResult( 143 def _UpdateTryJobResult(
141 self, status, master_name, builder_name, build_number, try_job_type, 144 self, status, master_name, builder_name, build_number, try_job_type,
142 try_job_id, try_job_url, result_content=None): 145 try_job_id, try_job_url, result_content=None):
143 """Updates try job result based on responsed try job status and result.""" 146 """Updates try job result based on responsed try job status and result."""
144 result = { 147 result = {
145 'report': result_content, 148 'report': result_content,
146 'url': try_job_url, 149 'url': try_job_url,
147 'try_job_id': try_job_id, 150 'try_job_id': try_job_id,
148 } 151 }
149 152
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 already_set_started = True 234 already_set_started = True
232 235
233 if time.time() > deadline: # pragma: no cover 236 if time.time() > deadline: # pragma: no cover
234 self._UpdateTryJobMetadata(try_job_data, start_time, build, error, True) 237 self._UpdateTryJobMetadata(try_job_data, start_time, build, error, True)
235 # Explicitly abort the whole pipeline. 238 # Explicitly abort the whole pipeline.
236 raise pipeline.Abort( 239 raise pipeline.Abort(
237 'Try job %s timed out after %d hours.' % ( 240 'Try job %s timed out after %d hours.' % (
238 try_job_id, timeout_hours)) 241 try_job_id, timeout_hours))
239 242
240 time.sleep(pipeline_wait_seconds) # pragma: no cover 243 time.sleep(pipeline_wait_seconds) # pragma: no cover
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698