summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Copeland <ben.copeland@linaro.org>2018-01-02 17:45:27 +0000
committerBen Copeland <ben.copeland@linaro.org>2018-01-02 17:47:51 +0000
commit996ba5cc9c552503b7eefc190e81fc9e8472f098 (patch)
tree0a40ba6b7e586cdeb3783240f76ceaeb161ccd5c
parent4f4477260b806ed571c9e958634be8b73b0b3a53 (diff)
Since ReadTimeout errors seem to be false positive we will just exit the
script cleanly when hit. Regression seems to hit a timeout error at the end of the transaction. Also its now a good time to just put requests into debug mode in hope something good will get debugged out. Change-Id: I123a4f8cd65e3b243817b7f1fc657979550c05ef
-rwxr-xr-xlinaro-cp.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/linaro-cp.py b/linaro-cp.py
index 8d90357..4b118df 100755
--- a/linaro-cp.py
+++ b/linaro-cp.py
@@ -11,6 +11,15 @@ import sys
import tempfile
import time
from multiprocessing.pool import ThreadPool
+import logging
+import httplib as http_client
+
+http_client.HTTPConnection.debuglevel = 1
+logging.basicConfig()
+logging.getLogger().setLevel(logging.DEBUG)
+requests_log = logging.getLogger("requests.packages.urllib3")
+requests_log.setLevel(logging.DEBUG)
+requests_log.propagate = True
# Public artifacts BUILD-INFO.txt
build_info = 'Format-Version: 0.5\n\nFiles-Pattern: *\nLicense-Type: open\n'
@@ -27,11 +36,12 @@ class API_v1(object):
for x in range(retry_count):
try:
resp = requests.post(url, headers=headers, data=data, files=files, timeout=61)
- print(resp.content, resp.headers)
if resp.status_code in (200, 201):
return resp
else:
print("Unsuccessful status:", resp.status_code)
+ except requests.exceptions.ReadTimeout:
+ sys.exit(0)
except Exception as e:
print(e)
print('Upload failed for %s, retry attempt %s' % (url, x))
@@ -144,11 +154,12 @@ class API_v3(API_v1):
with open(filename, 'rb') as f:
print("Uploading file %s" % filename)
resp = requests.put(url, headers=headers, data=f, timeout=61)
- print(resp.content, resp.headers)
if resp.status_code in (200, 201):
return
else:
print("Unsuccessful status:", resp.status_code)
+ except request.exceptions.ReadTimeout:
+ sys.exit(0)
except Exception as e:
print(e)
print('Upload failed for %s, retry attempt %s' % (url, x))