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

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: Adding index 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
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 model import wf_analysis_status 9 from model import wf_analysis_status
10 from model.wf_try_job import WfTryJob 10 from model.wf_try_job import WfTryJob
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 # Arguments number differs from overridden method - pylint: disable=W0221 62 # Arguments number differs from overridden method - pylint: disable=W0221
63 # TODO(chanli): Handle try job for test failures later. 63 # TODO(chanli): Handle try job for test failures later.
64 def run(self, master_name, builder_name, build_number, try_job_id): 64 def run(self, master_name, builder_name, build_number, try_job_id):
65 assert try_job_id 65 assert try_job_id
66 66
67 timeout_hours = 5 # Timeout after 5 hours. 67 timeout_hours = 5 # Timeout after 5 hours.
68 deadline = time.time() + timeout_hours * 60 * 60 68 deadline = time.time() + timeout_hours * 60 * 60
69 try_job_data = (WfTryJobData.Get(try_job_id) or 69 try_job_data = (WfTryJobData.Get(try_job_id) or
70 WfTryJobData.Create(try_job_id)) 70 WfTryJobData.Create(try_job_id))
71 try_job_data.master_name = master_name
72 try_job_data.builder_name = builder_name
71 73
72 already_set_started = False 74 already_set_started = False
73 start_time = None 75 start_time = None
74 while True: 76 while True:
75 error, build = buildbucket_client.GetTryJobs([try_job_id])[0] 77 error, build = buildbucket_client.GetTryJobs([try_job_id])[0]
76 if error: # pragma: no cover 78 if error: # pragma: no cover
77 self._UpdateTryJobMetadataForBuildError(try_job_data, error) 79 self._UpdateTryJobMetadataForBuildError(try_job_data, error)
78 raise pipeline.Retry( 80 raise pipeline.Retry(
79 'Error "%s" occurred. Reason: "%s"' % (error.message, error.reason)) 81 'Error "%s" occurred. Reason: "%s"' % (error.message, error.reason))
80 82
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 128
127 if time.time() > deadline: # pragma: no cover 129 if time.time() > deadline: # pragma: no cover
128 try_job_result.status = wf_analysis_status.ERROR 130 try_job_result.status = wf_analysis_status.ERROR
129 try_job_result.put() 131 try_job_result.put()
130 self._UpdateTryJobMetadataForCompletedBuild( 132 self._UpdateTryJobMetadataForCompletedBuild(
131 try_job_data, build, start_time, timed_out=True) 133 try_job_data, build, start_time, timed_out=True)
132 # Explicitly abort the whole pipeline. 134 # Explicitly abort the whole pipeline.
133 raise pipeline.Abort( 135 raise pipeline.Abort(
134 'Try job %s timed out after %d hours.' % ( 136 'Try job %s timed out after %d hours.' % (
135 try_job_id, timeout_hours)) 137 try_job_id, timeout_hours))
OLDNEW
« appengine/findit/model/wf_try_job_data.py ('K') | « 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