Skip to content

Commit 3285e48

Browse files
author
Matt Sokoloff
committed
raise exception when export fails
1 parent a39ed1a commit 3285e48

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

labelbox/schema/project.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from labelbox.schema.data_row import DataRow
1212
from labelbox.orm import query
1313
from labelbox.schema.bulk_import_request import BulkImportRequest
14-
from labelbox.exceptions import InvalidQueryError
14+
from labelbox.exceptions import InvalidQueryError, LabelboxError
1515
from labelbox.orm.db_object import DbObject, Updateable, Deletable
1616
from labelbox.orm.model import Entity, Field, Relationship
1717
from labelbox.pagination import PaginatedCollection
@@ -179,10 +179,14 @@ def export_queued_data_rows(self, timeout_seconds=120):
179179
res = res["exportQueuedDataRows"]
180180
if res["status"] == "COMPLETE":
181181
return res["downloadUrl"]
182+
elif res["status"] == "FAILED":
183+
raise LabelboxError("Data row export failed.")
182184

183185
timeout_seconds -= sleep_time
184186
if timeout_seconds <= 0:
185-
return None
187+
raise LabelboxError(
188+
f"Unable to export data rows within {timeout_seconds} seconds."
189+
)
186190

187191
logger.debug(
188192
"Project '%s' queued data row export, waiting for server...",

0 commit comments

Comments
 (0)