Skip to content

Polling job status sleep time #64

@hrubanj

Description

@hrubanj

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):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions