Skip to content

Commit 3c7128e

Browse files
authored
Merge pull request #855 from Labelbox/ms/retry-connection-timeouts
retry connection timeouts
2 parents 249d1bc + 943e659 commit 3c7128e

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
# Version 3.37.0 (2023-xx-xx)
4+
## Fixed
5+
* Retry connection timeouts
6+
37
# Version 3.36.1 (2023-01-24)
48
### Fixed
59
* `confidence` is now optional for TextEntity

labelbox/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ def __init__(self,
9797
self._data_row_metadata_ontology = None
9898

9999
@retry.Retry(predicate=retry.if_exception_type(
100-
labelbox.exceptions.InternalServerError))
100+
labelbox.exceptions.InternalServerError,
101+
labelbox.exceptions.TimeoutError))
101102
def execute(self,
102103
query=None,
103104
params=None,

tests/integration/test_client_errors.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import time
44
import pytest
5+
from google.api_core.exceptions import RetryError
56

67
from labelbox import Project, Dataset, User
78
import labelbox.client
@@ -43,12 +44,12 @@ def test_semantic_error(client):
4344

4445

4546
def test_timeout_error(client, project):
46-
with pytest.raises(labelbox.exceptions.TimeoutError) as excinfo:
47-
query_str = """query getOntology {
48-
project (where: {id: %s}) {
49-
ontology {
50-
normalized
51-
}
47+
with pytest.raises(RetryError) as excinfo:
48+
query_str = """query getOntology {
49+
project (where: {id: %s}) {
50+
ontology {
51+
normalized
52+
}
5253
}
5354
} """ % (project.uid)
5455

0 commit comments

Comments
 (0)