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

Unified Diff: swarm_get_results.py

Issue 23431002: [Abandoned] Move url_open with dependencies to utils.net module. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/swarm_client
Patch Set: Created 7 years, 4 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 | « run_isolated.py ('k') | swarm_trigger_step.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: swarm_get_results.py
diff --git a/swarm_get_results.py b/swarm_get_results.py
index b45a445253bf9292c3d225fbee20578fcbdd77f6..04b652fdf95c6f0ccdf5c100e8bb9e6e0be478bb 100755
--- a/swarm_get_results.py
+++ b/swarm_get_results.py
@@ -16,8 +16,7 @@ import urllib
from third_party.depot_tools import fix_encoding
-import run_isolated
-
+from utils import net
from utils import threading_utils
from utils import tools
@@ -38,8 +37,8 @@ def get_test_keys(swarm_base_url, test_name, _=None):
key_data = urllib.urlencode([('name', test_name)])
url = '%s/get_matching_test_cases?%s' % (swarm_base_url, key_data)
- for i in range(run_isolated.URL_OPEN_MAX_ATTEMPTS):
- response = run_isolated.url_open(url, retry_404=True)
+ for i in range(net.URL_OPEN_MAX_ATTEMPTS):
+ response = net.url_open(url, retry_404=True)
if response is None:
raise Failure(
'Error: Unable to find any tests with the name, %s, on swarm server'
@@ -50,8 +49,8 @@ def get_test_keys(swarm_base_url, test_name, _=None):
if 'No matching' in result:
logging.warning('Unable to find any tests with the name, %s, on swarm '
'server' % test_name)
- if i != run_isolated.URL_OPEN_MAX_ATTEMPTS:
- run_isolated.HttpService.sleep_before_retry(i, None)
+ if i != net.URL_OPEN_MAX_ATTEMPTS:
+ net.HttpService.sleep_before_retry(i, None)
continue
return json.loads(result)
@@ -76,14 +75,13 @@ def retrieve_results(base_url, test_key, timeout, should_stop):
logging.error('retrieve_results(%s) timed out', base_url)
return {}
# Do retries ourselves.
- response = run_isolated.url_open(
- result_url, retry_404=False, retry_50x=False)
+ response = net.url_open(result_url, retry_404=False, retry_50x=False)
if response is None:
# Aggressively poll for results. Do not use retry_404 so
# should_stop is polled more often.
remaining = min(5, timeout - (now() - start)) if timeout else 5
if remaining > 0:
- run_isolated.HttpService.sleep_before_retry(1, remaining)
+ net.HttpService.sleep_before_retry(1, remaining)
else:
try:
data = json.load(response) or {}
« no previous file with comments | « run_isolated.py ('k') | swarm_trigger_step.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698