Skip to content

Commit 32d4a8d

Browse files
committed
OTHER: When retrying a get available job chunks call in helpers and samples, we were incorrectly referencing a variable that no longer exists. Added variable to helper constructor which allows users to specify the number of seconds to wait between retrying the get job chunks availble call. Default is to wait 60 seconds. Also updated the samples to specify a number.
1 parent 7426435 commit 32d4a8d

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

ds3/ds3Helpers.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,9 @@ def object_name_to_file_path(object_name: str) -> str:
8888

8989

9090
class Helper(object):
91-
def __init__(self, client: Client):
91+
def __init__(self, client: Client, retry_delay_in_seconds: int = 60):
9292
self.client = client
93+
self.retry_delay_in_seconds = retry_delay_in_seconds
9394

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

122123
if len(chunks) <= 0:
123-
time.sleep(available_chunks.retryAfter)
124+
time.sleep(self.retry_delay_in_seconds)
124125
continue
125126

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

209210
if len(chunks) <= 0:
210-
time.sleep(available_chunks.retryAfter)
211+
time.sleep(self.retry_delay_in_seconds)
211212
continue
212213

213214
# retrieve all available blobs concurrently

samples/gettingData.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
# Check to make sure we got some chunks, if we did not sleep and retry.
6868
# Having no chunks ready may indicate that the BP cache is currently full.
6969
if len(chunks) == 0:
70-
time.sleep(availableChunks.retryAfter)
70+
time.sleep(60)
7171
continue
7272

7373
# For each chunk that is available, check to make sure we haven't processed it already.

samples/puttingData.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def pathForResource(resourceName):
6161
# check to make sure we got some chunks, if we did not
6262
# sleep and retry. This could mean that the cache is full
6363
if len(chunks) == 0:
64-
time.sleep(availableChunks.retryAfter)
64+
time.sleep(60)
6565
continue
6666

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

samples/puttingDataWithCRC32.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def pathForResource(resourceName):
6363
# check to make sure we got some chunks, if we did not
6464
# sleep and retry. This could mean that the cache is full
6565
if len(chunks) == 0:
66-
time.sleep(availableChunks.retryAfter)
66+
time.sleep(60)
6767
continue
6868

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

samples/renaming.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def fileNameToDs3PutObject(fileName, realFileName):
6767
# check to make sure we got some chunks, if we did not
6868
# sleep and retry. This could mean that the cache is full
6969
if len(chunks) == 0:
70-
time.sleep(availableChunks.retryAfter)
70+
time.sleep(60)
7171
continue
7272

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

0 commit comments

Comments
 (0)