summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Sokolovsky <paul.sokolovsky@linaro.org>2020-05-29 15:37:57 +0300
committerPaul Sokolovsky <paul.sokolovsky@linaro.org>2020-05-29 15:37:57 +0300
commita69bde758cbe967423b25ae8a1484c8ea9c34f56 (patch)
tree811f280c43eb2e7cf9e77bef3c359391aa35d1e3
parente1ddee4ddb9a1c57c37f1876a114e7e40410bf32 (diff)
Don't exit cleanly in case of exception, fix retry logic.HEADmaster
There were a couple issues: 1. There was initially a "while" loop to handle retries, with explicit variable decrement. In 3eab747f that was converted to the "for" loop, but variable decrement remained. 2. The script terminated with a successful exit code in case of *any* exception. It seems that initially that was a workaround of ReadError, but with future refactors, it got converted to *any* exception. There also was a logic to for that to happen on the last retry, but due to wrong variable being used in the check (see above) it happened on 2nd retry. In other words, absolutely any exception which happened, lead to successful termination of script, on just 2nd retry. Changes: a) leave the "for" loop, but then remove the variable decrement; b) remove "premature successful exit" condition altgether, now after all retries are exhausted, the script will terminate with an exception which was there right from the beginning. For future, if there're really cases of false-positive read errors, we should "mask" them with (more, longer) retries, rather than with success exits, or we risk to mask real problems in publishing. Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org> Change-Id: I9630a33f9bfb085e8b86e75aff6518fda28510be
-rwxr-xr-xlinaro-cp.py6
1 files changed, 0 insertions, 6 deletions
diff --git a/linaro-cp.py b/linaro-cp.py
index d57cd4a..802adcf 100755
--- a/linaro-cp.py
+++ b/linaro-cp.py
@@ -34,11 +34,8 @@ class API_v1(object):
print(("Unsuccessful status:", resp.status_code, resp.content))
except Exception as e:
print(e)
- if retry_count == 4:
- sys.exit(0)
print(('Upload failed for %s, retry attempt %s' % (url, x)))
time.sleep(2 * x + 1)
- retry_count -= 1
raise Exception("LLP request failed")
@@ -160,11 +157,8 @@ class API_v3(API_v1):
print(("Unsuccessful status:", resp.status_code, resp.content))
except Exception as e:
print(e)
- if retry_count == 4:
- sys.exit(0)
print(('Upload failed for %s, retry attempt %s' % (url, x)))
time.sleep(2 * x + 1)
- retry_count -= 1
raise Exception("S3 upload failed")