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

Side by Side Diff: appengine/chromium_cq_status/handlers/patch_summary.py

Issue 1877453003: Only try to compute running_all_jobs time if we know when try-job verifier started (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Added tests 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
« no previous file with comments | « no previous file | appengine/chromium_cq_status/handlers/test/patch_summary_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 from itertools import chain 6 from itertools import chain
7 import logging 7 import logging
8 8
9 import webapp2 9 import webapp2
10 10
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 timestamp = to_unix_timestamp(record.timestamp) 94 timestamp = to_unix_timestamp(record.timestamp)
95 if last_patch_action: 95 if last_patch_action:
96 patch_state_duration = timestamp - last_patch_timestamp 96 patch_state_duration = timestamp - last_patch_timestamp
97 97
98 # Verifier job updates. 98 # Verifier job updates.
99 if verifier == TRYJOBVERIFIER: 99 if verifier == TRYJOBVERIFIER:
100 if action == 'verifier_start': 100 if action == 'verifier_start':
101 verifier_start_timestamp = timestamp 101 verifier_start_timestamp = timestamp
102 elif action == 'verifier_jobs_update': 102 elif action == 'verifier_jobs_update':
103 job_tracker.update_jobs(record) 103 job_tracker.update_jobs(record)
104 elif action in ('verifier_pass', 'verifier_fail'): 104 elif (action in ('verifier_pass', 'verifier_fail') and
105 verifier_start_timestamp is not None):
105 durations['running_all_jobs'] = timestamp - verifier_start_timestamp 106 durations['running_all_jobs'] = timestamp - verifier_start_timestamp
106 verifier_start_timestamp = None 107 verifier_start_timestamp = None
107 108
108 # Patch state updates. 109 # Patch state updates.
109 if action and action.startswith('patch_'): 110 if action and action.startswith('patch_'):
110 if last_patch_action == 'patch_throttled': 111 if last_patch_action == 'patch_throttled':
111 durations['blocked_on_throttled_tree'] += patch_state_duration 112 durations['blocked_on_throttled_tree'] += patch_state_duration
112 if last_patch_action == 'patch_tree_closed': 113 if last_patch_action == 'patch_tree_closed':
113 durations['blocked_on_closed_tree'] += patch_state_duration 114 durations['blocked_on_closed_tree'] += patch_state_duration
114 if action == 'patch_committed': 115 if action == 'patch_committed':
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 return min(iterable) 276 return min(iterable)
276 except ValueError: # pragma: no cover 277 except ValueError: # pragma: no cover
277 return None 278 return None
278 279
279 280
280 def maybe_max(iterable): 281 def maybe_max(iterable):
281 try: 282 try:
282 return max(iterable) 283 return max(iterable)
283 except ValueError: # pragma: no cover 284 except ValueError: # pragma: no cover
284 return None 285 return None
OLDNEW
« no previous file with comments | « no previous file | appengine/chromium_cq_status/handlers/test/patch_summary_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698