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

Unified Diff: appengine/findit/waterfall/monitor_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/findit/model/wf_try_job_data.py ('k') | appengine/findit/waterfall/schedule_try_job_pipeline.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/waterfall/monitor_try_job_pipeline.py
diff --git a/appengine/findit/waterfall/monitor_try_job_pipeline.py b/appengine/findit/waterfall/monitor_try_job_pipeline.py
index 62c4093c4a89e974ee49f10b8733a23edcbe6c42..d0f78a2a2fc2042d0696d7be632debbf95f8b24a 100644
--- a/appengine/findit/waterfall/monitor_try_job_pipeline.py
+++ b/appengine/findit/waterfall/monitor_try_job_pipeline.py
@@ -110,20 +110,23 @@ class MonitorTryJobPipeline(BasePipeline):
def _UpdateTryJobMetadata(try_job_data, start_time, buildbucket_build,
buildbucket_error, timed_out):
buildbucket_response = {}
+
if buildbucket_build:
- try_job_data.request_time = MonitorTryJobPipeline._MicrosecondsToDatetime(
- buildbucket_build.request_time)
+ try_job_data.request_time = (
+ try_job_data.request_time or
+ MonitorTryJobPipeline._MicrosecondsToDatetime(
+ buildbucket_build.request_time))
# If start_time is unavailable, fallback to request_time.
try_job_data.start_time = start_time or try_job_data.request_time
try_job_data.end_time = MonitorTryJobPipeline._MicrosecondsToDatetime(
buildbucket_build.end_time)
try_job_data.number_of_commits_analyzed = len(
buildbucket_build.report.get('result', {}))
- try_job_data.try_job_url = buildbucket_build.url
try_job_data.regression_range_size = buildbucket_build.report.get(
'metadata', {}).get('regression_range_size')
- try_job_data.last_buildbucket_response = buildbucket_build.response
+ try_job_data.try_job_url = buildbucket_build.url
buildbucket_response = buildbucket_build.response
+ try_job_data.last_buildbucket_response = buildbucket_response
error_dict, error_code = MonitorTryJobPipeline._GetError(
buildbucket_response, buildbucket_error, timed_out)
@@ -180,13 +183,7 @@ class MonitorTryJobPipeline(BasePipeline):
# TODO(chanli): Make sure total wait time equals to timeout_hours
# regardless of retries.
deadline = time.time() + timeout_hours * 60 * 60
- try_job_data = (WfTryJobData.Get(try_job_id) or
- WfTryJobData.Create(try_job_id))
- try_job_data.master_name = master_name
- try_job_data.builder_name = builder_name
- try_job_data.build_number = build_number
- try_job_data.try_job_type = try_job_type
-
+ try_job_data = WfTryJobData.Get(try_job_id)
already_set_started = False
start_time = None
while True:
@@ -222,6 +219,15 @@ class MonitorTryJobPipeline(BasePipeline):
self._UpdateTryJobResult(
BuildbucketBuild.STARTED, master_name, builder_name, build_number,
try_job_type, try_job_id, build.url)
+
+ # Update as much try job metadata as soon as possible to avoid data
+ # loss in case of errors.
+ try_job_data.start_time = start_time
+ try_job_data.request_time = (
+ MonitorTryJobPipeline._MicrosecondsToDatetime(build.request_time))
+ try_job_data.try_job_url = build.url
+ try_job_data.put()
+
already_set_started = True
if time.time() > deadline: # pragma: no cover
« no previous file with comments | « appengine/findit/model/wf_try_job_data.py ('k') | appengine/findit/waterfall/schedule_try_job_pipeline.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698