@@ -205,6 +205,7 @@ def export_queued_data_rows(
205
205
{exportQueuedDataRows(data:{projectId: $%s , includeMetadataInput: $%s}) {downloadUrl createdAt status} }
206
206
""" % (id_param , metadata_param , id_param , metadata_param )
207
207
sleep_time = 2
208
+ start_time = time .time ()
208
209
while True :
209
210
res = self .client .execute (query_str , {
210
211
id_param : self .uid ,
@@ -219,8 +220,8 @@ def export_queued_data_rows(
219
220
elif res ["status" ] == "FAILED" :
220
221
raise LabelboxError ("Data row export failed." )
221
222
222
- timeout_seconds -= sleep_time
223
- if timeout_seconds <= 0 :
223
+ current_time = time . time ()
224
+ if current_time - start_time > timeout_seconds :
224
225
raise LabelboxError (
225
226
f"Unable to export data rows within { timeout_seconds } seconds."
226
227
)
@@ -328,6 +329,7 @@ def _validate_datetime(string_date: str) -> bool:
328
329
{exportLabels(data:{projectId: $%s%s}) {downloadUrl createdAt shouldPoll} }
329
330
""" % (id_param , id_param , filter_param )
330
331
332
+ start_time = time .time ()
331
333
while True :
332
334
res = self .client .execute (query_str , {id_param : self .uid })
333
335
res = res ["exportLabels" ]
@@ -340,8 +342,8 @@ def _validate_datetime(string_date: str) -> bool:
340
342
response .raise_for_status ()
341
343
return response .json ()
342
344
343
- timeout_seconds -= sleep_time
344
- if timeout_seconds <= 0 :
345
+ current_time = time . time ()
346
+ if current_time - start_time > timeout_seconds :
345
347
return None
346
348
347
349
logger .debug ("Project '%s' label export, waiting for server..." ,
0 commit comments