File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -205,6 +205,7 @@ def run_procedure(self) -> tuple[list[str], list[str]]:
205
205
break
206
206
LOGGER .info ("Retrying due to PARTIAL status." )
207
207
self .batch_client .restart_job (batch_request )
208
+ batch_request = self ._wait_for_partial_status_update (batch_request )
208
209
results = self ._monitor_job (batch_request )
209
210
210
211
processed = self ._get_tile_names_from_results (results , BatchTileStatus .PROCESSED )
@@ -214,6 +215,17 @@ def run_procedure(self) -> tuple[list[str], list[str]]:
214
215
LOGGER .info (log_msg )
215
216
return processed , failed
216
217
218
+ def _wait_for_partial_status_update (self , batch_request : BatchRequest ) -> BatchRequest :
219
+ """Wait for the batch job to update the status to PARTIAL with an exponential backoff."""
220
+ wait_time , max_wait_time = 1 , 5 * 60
221
+ while wait_time < max_wait_time :
222
+ time .sleep (wait_time )
223
+ wait_time *= 2
224
+ if self .batch_client .get_request (batch_request ).status != BatchRequestStatus .PARTIAL :
225
+ break
226
+
227
+ return self .batch_client .get_request (batch_request )
228
+
217
229
def _create_or_collect_batch_request (self ) -> BatchRequest :
218
230
"""Either creates a new batch request or collects information about an existing one."""
219
231
if not self .config .batch_id :
You can’t perform that action at this time.
0 commit comments