Hello guys,
I believe there is a minor bug in the computation of sleep time between successive API calls.
The retries variable does not get incremented and therefore the sleep time is always 2 seconds.
This does not impact me in any significant way. I just noticed that this might not have been the original intention and wanted to let you know.
|
def block_until_completed(self, job_id): |
|
""" |
|
Poll the API until the job is completed. |
|
|
|
Args: |
|
job_id (str): The id of the job |
|
|
|
Returns: |
|
response_body: The parsed json from the HTTP response |
|
containing a storage Job. |
|
|
|
Raises: |
|
requests.HTTPError: If any API request fails. |
|
""" |
|
retries = 1 |
|
while True: |
|
job = self.detail(job_id) |
|
if job['status'] in ('error', 'success'): |
|
return job |
|
time.sleep(min(2 ** retries, 20)) |
|
|
|
def block_for_success(self, job_id): |
Hello guys,
I believe there is a minor bug in the computation of sleep time between successive API calls.
The retries variable does not get incremented and therefore the sleep time is always 2 seconds.
This does not impact me in any significant way. I just noticed that this might not have been the original intention and wanted to let you know.
sapi-python-client/kbcstorage/jobs.py
Lines 100 to 121 in 5a93926