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

Unified Diff: scripts/master/try_job_rietveld.py

Issue 334013004: Factored out calls to client.getPage to factor out common constants (timeout and buildbot name) and… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 6 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/master/try_job_rietveld.py
diff --git a/scripts/master/try_job_rietveld.py b/scripts/master/try_job_rietveld.py
index 983c2e5979670d8b26867ea7cf16b1fc2be1e19d..3c8b6bffd6c2c234cb89c36d41f43615b47dc769 100644
--- a/scripts/master/try_job_rietveld.py
+++ b/scripts/master/try_job_rietveld.py
@@ -222,7 +222,7 @@ class _RietveldPollerWithCache(base.PollingChangeSource):
this cache is initialized with jobs currently pending on the Buildbot.
"""
- def __init__(self, pending_jobs_url, interval):
+ def __init__(self, pending_jobs_url, interval, timeout=2*60):
"""
Args:
pending_jobs_url: Rietveld URL string used to retrieve jobs to try.
@@ -232,6 +232,11 @@ class _RietveldPollerWithCache(base.PollingChangeSource):
self._try_job_rietveld = None
self._pending_jobs_url = pending_jobs_url
self._processed_keys = None
+ self.timeout = timeout
+
+ def getPage(self, url): # pylint: disable=R0201
+ """Schedules a page at `url` to be downloaded. Returns a deferred."""
+ return client.getPage(url, agent='buildbot', timeout=self.timeout)
# base.PollingChangeSource overrides:
def poll(self):
@@ -253,8 +258,7 @@ class _RietveldPollerWithCache(base.PollingChangeSource):
log.msg('[RPWC] Poll started')
log.msg('[RPWC] Downloading %s...' % self._pending_jobs_url)
- pollDeferred = client.getPage(self._pending_jobs_url, agent='buildbot',
- timeout=2*60)
+ pollDeferred = self.getPage(self._pending_jobs_url)
pollDeferred.addCallback(self._ProcessResults)
pollDeferred.addErrback(log.err, '[RPWC] error')
return pollDeferred
@@ -322,7 +326,7 @@ class _RietveldPollerWithCache(base.PollingChangeSource):
next_url = self._pending_jobs_url + '&cursor=%s' % str(results['cursor'])
prev_cursor = results['cursor']
log.msg('[RPWC] Downloading %s...' % next_url)
- page_json = yield client.getPage(next_url, agent='buildbot', timeout=2*60)
+ page_json = yield self.getPage(next_url)
results = json.loads(page_json)
log.msg('[RPWC] Retrieved %d jobs' % len(all_jobs))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698