Skip to content

Commit

Permalink
increase timeout. Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Sokoloff committed Mar 7, 2021
1 parent a989935 commit b007f9a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion labelbox/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __init__(self,
#TODO: Add exponential backoff so we don'tt overwhelm the api
@retry.Retry(predicate=retry.if_exception_type(
labelbox.exceptions.InternalServerError))
def execute(self, query, params=None, timeout=10.0):
def execute(self, query, params=None, timeout=30.0):
""" Sends a request to the server for the execution of the
given query.
Expand Down
7 changes: 3 additions & 4 deletions tests/integration/test_client_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,24 +112,23 @@ def test_invalid_attribute_error(client, rand_gen):

@pytest.mark.skip("timeouts cause failure before rate limit")
def test_api_limit_error(client):
global limited
limited = False

def get(arg):
try:
return client.get_user()
except labelbox.exceptions.ApiLimitError as e:
return e

#Rate limited at 1500 + buffer
n = 1600
#max of 30 concurrency before the service becomes unavailable
with Pool(30) as pool:
start = time.time()
results = list(pool.imap(get, range(n)), total=n)
elapsed = time.time() - start

assert elapsed < 60, "Didn't finish fast enough"
assert labelbox.exceptions.ApiLimitError in {type(r) for r in results}
del limited

# Sleep at the end of this test to allow other tests to execute.
#time.sleep(60)
time.sleep(60)

0 comments on commit b007f9a

Please sign in to comment.