Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # coding=utf8 | 1 # coding=utf8 |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 """Postpone commits until the tree is open.""" | 5 """Postpone commits until the tree is open.""" |
| 6 | 6 |
| 7 import calendar | 7 import calendar |
| 8 import json | 8 import json |
| 9 import logging | 9 import logging |
| 10 import time | 10 import time |
| 11 import urllib2 | 11 import urllib2 |
| 12 | 12 |
| 13 from verification import base | 13 from verification import base |
| 14 | 14 |
| 15 | 15 |
| 16 class TreeStatus(base.IVerifierStatus): | 16 class TreeStatus(base.IVerifierStatus): |
| 17 persistent = base.IVerifierStatus.persistent + [ | 17 tree_status_url = str |
|
csharp
2012/11/23 18:31:58
Is it ok for this class to now get constructed wit
M-A Ruel
2012/11/23 18:44:06
First, some background: it's a design issue that t
| |
| 18 'tree_status_url', | |
| 19 ] | |
| 20 | |
| 21 def __init__(self, tree_status_url): | |
| 22 super(TreeStatus, self).__init__() | |
| 23 self.tree_status_url = tree_status_url | |
| 24 | 18 |
| 25 def get_state(self): | 19 def get_state(self): |
| 26 return base.SUCCEEDED | 20 return base.SUCCEEDED |
| 27 | 21 |
| 28 def postpone(self): | 22 def postpone(self): |
| 29 try: | 23 try: |
| 30 logging.debug('Fetching tree status for %s' % self.tree_status_url) | 24 logging.debug('Fetching tree status for %s' % self.tree_status_url) |
| 31 now = time.time() | 25 now = time.time() |
| 32 cutoff = now - 5 * 60 | 26 cutoff = now - 5 * 60 |
| 33 url = self.tree_status_url + '/allstatus?format=json&endTime=%d' % cutoff | 27 url = self.tree_status_url + '/allstatus?format=json&endTime=%d' % cutoff |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 58 def __init__(self, tree_status_url): | 52 def __init__(self, tree_status_url): |
| 59 super(TreeStatusVerifier, self).__init__() | 53 super(TreeStatusVerifier, self).__init__() |
| 60 self.tree_status_url = tree_status_url | 54 self.tree_status_url = tree_status_url |
| 61 | 55 |
| 62 def verify(self, pending): | 56 def verify(self, pending): |
| 63 pending.verifications[self.name] = TreeStatus( | 57 pending.verifications[self.name] = TreeStatus( |
| 64 tree_status_url=self.tree_status_url) | 58 tree_status_url=self.tree_status_url) |
| 65 | 59 |
| 66 def update_status(self, queue): | 60 def update_status(self, queue): |
| 67 pass | 61 pass |
| OLD | NEW |