@@ -120,8 +120,8 @@ def __init__(
120120 self ._annotation_upload_data = None
121121 self ._item_ids = []
122122 self ._s3_bucket = None
123- self ._big_files_queue = asyncio . Queue ()
124- self ._small_files_queue = asyncio . Queue ()
123+ self ._big_files_queue = None
124+ self ._small_files_queue = None
125125 self ._report = Report ([], [], [], [])
126126
127127 @staticmethod
@@ -327,16 +327,14 @@ async def upload_small_annotations(self):
327327
328328 async def upload (_chunk ):
329329 try :
330- report = await self ._upload_small_annotations (chunk )
330+ report = await self ._upload_small_annotations (_chunk )
331331 self ._report .failed_annotations .extend (report .failed_annotations )
332332 self ._report .missing_classes .extend (report .missing_classes )
333333 self ._report .missing_attr_groups .extend (report .missing_attr_groups )
334334 self ._report .missing_attrs .extend (report .missing_attrs )
335- except Exception :
336- import traceback
337-
338- traceback .print_exc ()
339- self ._report .failed_annotations .extend ([i .name for i in chunk ])
335+ except Exception as e :
336+ self .reporter .log_debug (str (e ))
337+ self ._report .failed_annotations .extend ([i .name for i in _chunk ])
340338
341339 while True :
342340 item = await self ._small_files_queue .get ()
@@ -407,7 +405,10 @@ async def distribute_queues(self, items_to_upload: list):
407405 self ._big_files_queue .put_nowait (t_item )
408406 else :
409407 self ._small_files_queue .put_nowait (t_item )
410- except (ValidationError , AppException ):
408+ except Exception as e :
409+ self .reporter .log_debug (str (e ))
410+ data [idx ][1 ] = True
411+ self .reporter .update_progress ()
411412 self ._report .failed_annotations .append (item .name )
412413 finally :
413414 data [idx ][1 ] = True
@@ -417,6 +418,8 @@ async def distribute_queues(self, items_to_upload: list):
417418
418419 async def run_workers (self , items_to_upload ):
419420 try :
421+ self ._big_files_queue = asyncio .Queue ()
422+ self ._small_files_queue = asyncio .Queue ()
420423 await asyncio .gather (
421424 self .distribute_queues (items_to_upload ),
422425 self .upload_small_annotations (),
@@ -449,7 +452,6 @@ def execute(self):
449452 items_to_upload .append (self .AnnotationToUpload (item .uuid , name , path ))
450453 except KeyError :
451454 missing_annotations .append (name )
452-
453455 asyncio .run (self .run_workers (items_to_upload ))
454456 self .reporter .finish_progress ()
455457 self ._log_report ()
@@ -1228,8 +1230,6 @@ def iter_errors(self, instance, _schema=None):
12281230 validators .extend (jsonschema .validators .iteritems (_schema ))
12291231
12301232 for k , v in validators :
1231- if k == "createdBy" :
1232- print ()
12331233 validator = self .VALIDATORS .get (k )
12341234 if validator is None :
12351235 continue
0 commit comments