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

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

Issue 1866883002: [Findit] A huge refactoring and some bug fixing. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Fix nit. 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 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 analysis_status
11 from model.wf_try_job import WfTryJob 11 from model.wf_try_job import WfTryJob
12 from model.wf_try_job_data import WfTryJobData 12 from model.wf_try_job_data import WfTryJobData
13 from pipeline_wrapper import BasePipeline 13 from pipeline_wrapper import BasePipeline
14 from pipeline_wrapper import pipeline 14 from pipeline_wrapper import pipeline
15 from waterfall import waterfall_config 15 from waterfall import waterfall_config
16 from waterfall.try_job_type import TryJobType 16 from waterfall.try_job_type import TryJobType
17 17
18 18
19 class MonitorTryJobPipeline(BasePipeline): 19 class MonitorTryJobPipeline(BasePipeline):
20 """A pipeline for monitoring a try job and recording results when it's done. 20 """A pipeline for monitoring a try job and recording results when it's done.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 result_to_update = try_job_result.test_results 78 result_to_update = try_job_result.test_results
79 if (result_to_update and 79 if (result_to_update and
80 result_to_update[-1]['try_job_id'] == try_job_id): 80 result_to_update[-1]['try_job_id'] == try_job_id):
81 result_to_update[-1].update(result) 81 result_to_update[-1].update(result)
82 else: # pragma: no cover 82 else: # pragma: no cover
83 # Normally result for current try job should've been saved in 83 # Normally result for current try job should've been saved in
84 # schedule_try_job_pipeline, so this branch shouldn't be reached. 84 # schedule_try_job_pipeline, so this branch shouldn't be reached.
85 result_to_update.append(result) 85 result_to_update.append(result)
86 86
87 if status == BuildbucketBuild.STARTED: 87 if status == BuildbucketBuild.STARTED:
88 try_job_result.status = wf_analysis_status.ANALYZING 88 try_job_result.status = analysis_status.RUNNING
89 try_job_result.put() 89 try_job_result.put()
90 return result_to_update 90 return result_to_update
91 91
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 = waterfall_config.GetTryJobSettings().get( 98 timeout_hours = waterfall_config.GetTryJobSettings().get(
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 if time.time() > deadline: # pragma: no cover 152 if time.time() > deadline: # pragma: no cover
153 self._UpdateTryJobMetadataForCompletedBuild( 153 self._UpdateTryJobMetadataForCompletedBuild(
154 try_job_data, build, start_time, timed_out=True) 154 try_job_data, build, start_time, timed_out=True)
155 # Explicitly abort the whole pipeline. 155 # Explicitly abort the whole pipeline.
156 raise pipeline.Abort( 156 raise pipeline.Abort(
157 'Try job %s timed out after %d hours.' % ( 157 'Try job %s timed out after %d hours.' % (
158 try_job_id, timeout_hours)) 158 try_job_id, timeout_hours))
159 159
160 time.sleep(pipeline_wait_seconds) # pragma: no cover 160 time.sleep(pipeline_wait_seconds) # pragma: no cover
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698