| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |