Skip to content

Commit

Permalink
Merge pull request #44 from RachelTucker/OTHER-fix-retry-in-helpers
Browse files Browse the repository at this point in the history
OTHER: When retrying a get available job chunks call in helpers and samples, we were incorrectly referencing a variable that no longer exists
  • Loading branch information
bensont authored Apr 12, 2021
2 parents 7426435 + 32d4a8d commit cff790c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions ds3/ds3Helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ def object_name_to_file_path(object_name: str) -> str:


class Helper(object):
def __init__(self, client: Client):
def __init__(self, client: Client, retry_delay_in_seconds: int = 60):
self.client = client
self.retry_delay_in_seconds = retry_delay_in_seconds

def put_objects(self, put_objects: List[HelperPutObject], bucket: str, max_threads: int = 5) -> str:
ds3_put_objects: List[Ds3PutObject] = []
Expand Down Expand Up @@ -120,7 +121,7 @@ def put_objects(self, put_objects: List[HelperPutObject], bucket: str, max_threa
chunks = available_chunks.result['ObjectsList']

if len(chunks) <= 0:
time.sleep(available_chunks.retryAfter)
time.sleep(self.retry_delay_in_seconds)
continue

# retrieve all available blobs concurrently
Expand Down Expand Up @@ -207,7 +208,7 @@ def get_objects(self, get_objects: List[HelperGetObject], bucket: str, max_threa
chunks = available_chunks.result['ObjectsList']

if len(chunks) <= 0:
time.sleep(available_chunks.retryAfter)
time.sleep(self.retry_delay_in_seconds)
continue

# retrieve all available blobs concurrently
Expand Down
2 changes: 1 addition & 1 deletion samples/gettingData.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
# Check to make sure we got some chunks, if we did not sleep and retry.
# Having no chunks ready may indicate that the BP cache is currently full.
if len(chunks) == 0:
time.sleep(availableChunks.retryAfter)
time.sleep(60)
continue

# For each chunk that is available, check to make sure we haven't processed it already.
Expand Down
2 changes: 1 addition & 1 deletion samples/puttingData.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def pathForResource(resourceName):
# check to make sure we got some chunks, if we did not
# sleep and retry. This could mean that the cache is full
if len(chunks) == 0:
time.sleep(availableChunks.retryAfter)
time.sleep(60)
continue

# for each chunk that is available, check to make sure
Expand Down
2 changes: 1 addition & 1 deletion samples/puttingDataWithCRC32.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def pathForResource(resourceName):
# check to make sure we got some chunks, if we did not
# sleep and retry. This could mean that the cache is full
if len(chunks) == 0:
time.sleep(availableChunks.retryAfter)
time.sleep(60)
continue

# for each chunk that is available, check to make sure
Expand Down
2 changes: 1 addition & 1 deletion samples/renaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def fileNameToDs3PutObject(fileName, realFileName):
# check to make sure we got some chunks, if we did not
# sleep and retry. This could mean that the cache is full
if len(chunks) == 0:
time.sleep(availableChunks.retryAfter)
time.sleep(60)
continue

# for each chunk that is available, check to make sure
Expand Down

0 comments on commit cff790c

Please sign in to comment.