File tree 1 file changed +14
-3
lines changed
1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -205,23 +205,34 @@ def apply_registration_to_image(
205
205
# Get the relevant metadata of the Zarr table & add it
206
206
# See issue #516 for the need for this workaround
207
207
max_retries = 20
208
- sleep_time = 5
208
+ sleep_time = 10
209
209
current_round = 0
210
210
while current_round < max_retries :
211
211
try :
212
212
old_table_group = zarr .open_group (
213
213
table_dict [table ], mode = "r"
214
214
)
215
215
current_round = max_retries
216
- except zarr .errors .GroupNotFoundError :
216
+ curr_table = ad .read_zarr (table_dict [table ])
217
+ break # Exit loop on success
218
+ except (
219
+ zarr .errors .GroupNotFoundError ,
220
+ zarr .errors .PathNotFoundError ,
221
+ ):
217
222
logger .debug (
218
223
f"Table { table } not found in attempt { current_round } . "
219
224
f"Waiting { sleep_time } seconds before trying again."
220
225
)
221
226
current_round += 1
222
227
time .sleep (sleep_time )
228
+ else :
229
+ # This runs only if the loop exits via exhaustion
230
+ raise RuntimeError (
231
+ f"Table { table } not found after { max_retries } attempts."
232
+ "Check whether this table actually exists. If it does, "
233
+ "this may be a race condition issue."
234
+ )
223
235
# Write the Zarr table
224
- curr_table = ad .read_zarr (table_dict [table ])
225
236
write_table (
226
237
new_image_group ,
227
238
table ,
You can’t perform that action at this time.
0 commit comments