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

Unified Diff: isolateserver_archive.py

Issue 23657003: 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 | « no previous file | run_isolated.py » ('j') | run_isolated.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: isolateserver_archive.py
diff --git a/isolateserver_archive.py b/isolateserver_archive.py
index d3c9bb5a0b0087b789497f511d3b7bdbfb5a5991..030b05aa19d5b14f4b2b5538110bca4fdf1b6f28 100755
--- a/isolateserver_archive.py
+++ b/isolateserver_archive.py
@@ -19,6 +19,7 @@ import zlib
import run_isolated
+from utils import net
from utils import threading_utils
from utils import tools
@@ -118,7 +119,7 @@ def sha1_file(filepath):
def url_read(url, **kwargs):
- result = run_isolated.url_read(url, **kwargs)
+ result = net.url_read(url, **kwargs)
if result is None:
# If we get no response from the server, assume it is down and raise an
# exception.
@@ -143,21 +144,21 @@ def upload_hash_content_to_blobstore(
# TODO(maruel): Support large files. This would require streaming support.
content_type, body = encode_multipart_formdata(
data, [('content', hash_key, content)])
- for attempt in xrange(run_isolated.URL_OPEN_MAX_ATTEMPTS):
+ for attempt in xrange(net.URL_OPEN_MAX_ATTEMPTS):
# Retry HTTP 50x here.
- upload_url = run_isolated.url_read(generate_upload_url, data=data)
+ upload_url = net.url_read(generate_upload_url, data=data)
if not upload_url:
raise run_isolated.MappingError(
'Unable to connect to server %s' % generate_upload_url)
# Do not retry this request on HTTP 50x. Regenerate an upload url each time
# since uploading "consumes" the upload url.
- result = run_isolated.url_read(
+ result = net.url_read(
upload_url, data=body, content_type=content_type, retry_50x=False)
if result is not None:
return result
- if attempt != run_isolated.URL_OPEN_MAX_ATTEMPTS - 1:
- run_isolated.HttpService.sleep_before_retry(attempt, None)
+ if attempt != net.URL_OPEN_MAX_ATTEMPTS - 1:
+ net.HttpService.sleep_before_retry(attempt, None)
raise run_isolated.MappingError(
'Unable to connect to server %s' % generate_upload_url)
« no previous file with comments | « no previous file | run_isolated.py » ('j') | run_isolated.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698