Skip to content

Commit c0c3738

Browse files
committed
updates to merge
2 parents 39d0763 + 1a4965d commit c0c3738

File tree

4 files changed

+31
-8
lines changed

4 files changed

+31
-8
lines changed

CHANGELOG.md

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

3+
# Version 3.25.2 (2022-07-26)
4+
## Updated
5+
* Mask downloads now have retries
6+
* Failed `upload_data` now shows more details in the error message
7+
8+
## Fixed
9+
* Fixed Metadata not importing with DataRows when bulk importing local files.
10+
* Fixed COCOConverter failing for empty annotations
11+
12+
## Documentation
13+
* Notebooks are up-to-date with examples of importing annotations without `schema_id`
14+
15+
# Version 3.25.1 (2022-07-20)
16+
## Fixed
17+
* Removed extra dependency causing import errors.
18+
319
# Version 3.25.0 (2022-07-20)
420

521
## Added

labelbox/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name = "labelbox"
2-
__version__ = "3.25.1"
2+
__version__ = "3.25.2"
33

44
from labelbox.client import Client
55
from labelbox.schema.project import Project

labelbox/client.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,14 @@ def upload_data(self,
381381
"Failed to upload, unknown cause", e)
382382

383383
if not file_data or not file_data.get("uploadFile", None):
384+
try:
385+
errors = response.json().get("errors", [])
386+
error_msg = next(iter(errors), {}).get("message",
387+
"Unknown error")
388+
except Exception as e:
389+
error_msg = "Unknown error"
384390
raise labelbox.exceptions.LabelboxError(
385-
"Failed to upload, message: %s" % file_data or
386-
file_data.get("error"))
391+
"Failed to upload, message: %s" % error_msg)
387392

388393
return file_data["uploadFile"]["url"]
389394

labelbox/schema/project.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ def export_queued_data_rows(
205205
{exportQueuedDataRows(data:{projectId: $%s , includeMetadataInput: $%s}) {downloadUrl createdAt status} }
206206
""" % (id_param, metadata_param, id_param, metadata_param)
207207
sleep_time = 2
208+
start_time = time.time()
208209
while True:
209210
res = self.client.execute(query_str, {
210211
id_param: self.uid,
@@ -219,8 +220,8 @@ def export_queued_data_rows(
219220
elif res["status"] == "FAILED":
220221
raise LabelboxError("Data row export failed.")
221222

222-
timeout_seconds -= sleep_time
223-
if timeout_seconds <= 0:
223+
current_time = time.time()
224+
if current_time - start_time > timeout_seconds:
224225
raise LabelboxError(
225226
f"Unable to export data rows within {timeout_seconds} seconds."
226227
)
@@ -328,10 +329,11 @@ def _validate_datetime(string_date: str) -> bool:
328329
{exportLabels(data:{projectId: $%s%s}) {downloadUrl createdAt shouldPoll} }
329330
""" % (id_param, id_param, filter_param)
330331

332+
start_time = time.time()
331333
while True:
332334
res = self.client.execute(query_str, {id_param: self.uid})
333335
res = res["exportLabels"]
334-
if not res["shouldPoll"]:
336+
if not res["shouldPoll"] and res["downloadUrl"] is not None:
335337
url = res['downloadUrl']
336338
if not download:
337339
return url
@@ -340,8 +342,8 @@ def _validate_datetime(string_date: str) -> bool:
340342
response.raise_for_status()
341343
return response.json()
342344

343-
timeout_seconds -= sleep_time
344-
if timeout_seconds <= 0:
345+
current_time = time.time()
346+
if current_time - start_time > timeout_seconds:
345347
return None
346348

347349
logger.debug("Project '%s' label export, waiting for server...",

0 commit comments

Comments
 (0)