|
9 | 9 |
|
10 | 10 | import json |
11 | 11 | import logging |
12 | | -import time |
13 | 12 | import traceback |
14 | 13 | from ast import literal_eval |
15 | 14 | from pathlib import Path |
@@ -121,75 +120,16 @@ def register_lif_preprocessing_result( |
121 | 120 | murfey_db.add(clem_img_stk) |
122 | 121 | murfey_db.commit() |
123 | 122 |
|
124 | | - # Make multiple attempts to refresh data in case of race condition |
125 | | - attempts = 0 |
126 | | - while attempts < 50: |
127 | | - try: |
128 | | - murfey_db.refresh(clem_img_stk) |
129 | | - break |
130 | | - except Exception: |
131 | | - logger.warning( |
132 | | - f"Attempt {attempts + 1} at refreshing database entry for " |
133 | | - f"{str(result.image_stack)!r} failed: \n" |
134 | | - f"{traceback.format_exc()}" |
135 | | - ) |
136 | | - attempts += 1 |
137 | | - time.sleep(0.1) |
138 | | - else: |
139 | | - raise RuntimeError( |
140 | | - "Maximum number of attempts reached while trying to refresh database " |
141 | | - f"entry for {str(result.image_stack)!r}" |
142 | | - ) |
143 | | - |
144 | 123 | clem_img_series.associated_metadata = clem_metadata |
145 | 124 | clem_img_series.parent_lif = clem_lif_file |
146 | 125 | clem_img_series.number_of_members = result.number_of_members |
147 | 126 | murfey_db.add(clem_img_series) |
148 | 127 | murfey_db.commit() |
149 | 128 |
|
150 | | - # Make multiple attempts to refresh data in case of race condition |
151 | | - attempts = 0 |
152 | | - while attempts < 50: |
153 | | - try: |
154 | | - murfey_db.refresh(clem_img_series) |
155 | | - break |
156 | | - except Exception: |
157 | | - logger.warning( |
158 | | - f"Attempt {attempts + 1} at refreshing database entry for " |
159 | | - f"{str(result.series_name)!r} failed: \n" |
160 | | - f"{traceback.format_exc()}" |
161 | | - ) |
162 | | - attempts += 1 |
163 | | - time.sleep(0.1) |
164 | | - else: |
165 | | - raise RuntimeError( |
166 | | - "Maximum number of attempts reached while trying to refresh database " |
167 | | - f"entry for {str(result.series_name)!r}" |
168 | | - ) |
169 | | - |
170 | 129 | clem_metadata.parent_lif = clem_lif_file |
171 | 130 | murfey_db.add(clem_metadata) |
172 | 131 | murfey_db.commit() |
173 | 132 |
|
174 | | - # Make multiple attempts to refresh data in case of race condition |
175 | | - while attempts < 50: |
176 | | - try: |
177 | | - murfey_db.refresh(clem_metadata) |
178 | | - break |
179 | | - except Exception: |
180 | | - logger.warning( |
181 | | - f"Attempt {attempts + 1} at refreshing database entry for " |
182 | | - f"{str(result.metadata)!r} failed: \n" |
183 | | - f"{traceback.format_exc()}" |
184 | | - ) |
185 | | - attempts += 1 |
186 | | - time.sleep(0.1) |
187 | | - else: |
188 | | - raise RuntimeError( |
189 | | - "Maximum number of attempts reached while trying to refresh database " |
190 | | - f"entry for {str(result.metadata)!r}" |
191 | | - ) |
192 | | - |
193 | 133 | logger.info( |
194 | 134 | f"LIF preprocessing results registered for {result.series_name!r} " |
195 | 135 | f"{result.channel!r} image stack" |
@@ -357,77 +297,17 @@ def register_tiff_preprocessing_result( |
357 | 297 | murfey_db.add(clem_tiff_file) |
358 | 298 | murfey_db.commit() |
359 | 299 |
|
360 | | - # Make multiple attempts to refresh data in case of race condition |
361 | | - attempts = 0 |
362 | | - while attempts < 50: |
363 | | - try: |
364 | | - murfey_db.refresh(clem_tiff_file) |
365 | | - break |
366 | | - except Exception: |
367 | | - logger.warning( |
368 | | - f"Attempt {attempts + 1} at refreshing database entry for " |
369 | | - f"{str(file)!r} failed: \n" |
370 | | - f"{traceback.format_exc()}" |
371 | | - ) |
372 | | - attempts += 1 |
373 | | - time.sleep(0.1) |
374 | | - else: |
375 | | - raise RuntimeError( |
376 | | - "Maximum number of attempts reached while trying to refresh database " |
377 | | - f"entry for {str(file)!r}" |
378 | | - ) |
379 | | - |
380 | 300 | clem_img_stk.associated_metadata = clem_metadata |
381 | 301 | clem_img_stk.parent_series = clem_img_series |
382 | 302 | clem_img_stk.channel_name = result.channel |
383 | 303 | murfey_db.add(clem_img_stk) |
384 | 304 | murfey_db.commit() |
385 | 305 |
|
386 | | - # Make multiple attempts to refresh data in case of race condition |
387 | | - attempts = 0 |
388 | | - while attempts < 50: |
389 | | - try: |
390 | | - murfey_db.refresh(clem_img_stk) |
391 | | - break |
392 | | - except Exception: |
393 | | - logger.warning( |
394 | | - f"Attempt {attempts + 1} at refreshing database entry for " |
395 | | - f"{str(result.image_stack)!r} failed: \n" |
396 | | - f"{traceback.format_exc()}" |
397 | | - ) |
398 | | - attempts += 1 |
399 | | - time.sleep(0.1) |
400 | | - else: |
401 | | - raise RuntimeError( |
402 | | - "Maximum number of attempts reached while trying to refresh database " |
403 | | - f"entry for {str(result.image_stack)!r}" |
404 | | - ) |
405 | | - |
406 | 306 | clem_img_series.associated_metadata = clem_metadata |
407 | 307 | clem_img_series.number_of_members = result.number_of_members |
408 | 308 | murfey_db.add(clem_img_series) |
409 | 309 | murfey_db.commit() |
410 | 310 |
|
411 | | - # Make multiple attempts to refresh data in case of race condition |
412 | | - attempts = 0 |
413 | | - while attempts < 50: |
414 | | - try: |
415 | | - murfey_db.refresh(clem_img_series) |
416 | | - break |
417 | | - except Exception: |
418 | | - logger.warning( |
419 | | - f"Attempt {attempts + 1} at refreshing database entry for " |
420 | | - f"{str(result.series_name)!r} failed: \n" |
421 | | - f"{traceback.format_exc()}" |
422 | | - ) |
423 | | - attempts += 1 |
424 | | - time.sleep(0.1) |
425 | | - else: |
426 | | - raise RuntimeError( |
427 | | - "Maximum number of attempts reached while trying to refresh database " |
428 | | - f"entry for {str(result.series_name)!r}" |
429 | | - ) |
430 | | - |
431 | 311 | logger.info( |
432 | 312 | f"TIFF preprocessing results registered for {result.series_name!r} " |
433 | 313 | f"{result.channel!r} image stack" |
|
0 commit comments