@@ -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,6 +329,7 @@ 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" ]
@@ -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