Skip to content

Commit b007f9a

Browse files
author
Matt Sokoloff
committed
increase timeout. Minor changes
1 parent a989935 commit b007f9a

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

labelbox/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def __init__(self,
7474
#TODO: Add exponential backoff so we don'tt overwhelm the api
7575
@retry.Retry(predicate=retry.if_exception_type(
7676
labelbox.exceptions.InternalServerError))
77-
def execute(self, query, params=None, timeout=10.0):
77+
def execute(self, query, params=None, timeout=30.0):
7878
""" Sends a request to the server for the execution of the
7979
given query.
8080

tests/integration/test_client_errors.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,24 +112,23 @@ def test_invalid_attribute_error(client, rand_gen):
112112

113113
@pytest.mark.skip("timeouts cause failure before rate limit")
114114
def test_api_limit_error(client):
115-
global limited
116-
limited = False
117115

118116
def get(arg):
119117
try:
120118
return client.get_user()
121119
except labelbox.exceptions.ApiLimitError as e:
122120
return e
123121

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

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

134133
# Sleep at the end of this test to allow other tests to execute.
135-
#time.sleep(60)
134+
time.sleep(60)

0 commit comments

Comments
 (0)