@@ -238,7 +238,6 @@ def _validate_limitations(self, to_upload_count):
238238 ):
239239 raise AppValidationException (constances .ATTACH_USER_LIMIT_ERROR_MESSAGE )
240240
241-
242241 @property
243242 def annotation_status_code (self ):
244243 if self ._annotation_status :
@@ -1466,7 +1465,8 @@ def execute(self):
14661465 folder = self ._folder ,
14671466 backend_service_provider = self ._backend_client ,
14681467 attachments = [
1469- image .entity for image in uploaded_images [i : i + 100 ] # noqa: E203
1468+ image .entity
1469+ for image in uploaded_images [i : i + 100 ] # noqa: E203
14701470 ],
14711471 annotation_status = self ._annotation_status ,
14721472 upload_state_code = constances .UploadState .BASIC .value ,
@@ -1594,8 +1594,8 @@ def __init__(
15941594 def auth_data (self ):
15951595 if not self ._auth_data :
15961596 self ._auth_data = self ._backend_service .get_s3_upload_auth_token (
1597- self ._project .team_id , self ._folder .uuid , self ._project .uuid
1598- )
1597+ self ._project .team_id , self ._folder .uuid , self ._project .uuid
1598+ )
15991599 return self ._auth_data
16001600
16011601 @property
@@ -1926,7 +1926,9 @@ def execute(self):
19261926 response = AttachFileUrlsUseCase (
19271927 project = self ._project ,
19281928 folder = self ._folder ,
1929- attachments = self ._attachments [i : i + self .CHUNK_SIZE ], # noqa: E203
1929+ attachments = self ._attachments [
1930+ i : i + self .CHUNK_SIZE
1931+ ], # noqa: E203
19301932 backend_service_provider = self ._backend_service ,
19311933 annotation_status = self ._annotation_status ,
19321934 upload_state_code = self ._upload_state_code ,
@@ -2500,6 +2502,7 @@ def __init__(
25002502 self .missing_attribute_groups = set ()
25012503 self .missing_classes = set ()
25022504 self .missing_attributes = set ()
2505+ self ._failed_annotation_reports = []
25032506
25042507 @property
25052508 def s3_client (self ):
@@ -2741,6 +2744,7 @@ def execute(self):
27412744 missing_annotations ,
27422745 )
27432746 self .report_missing_data ()
2747+ self .report_failed_annotations ()
27442748 return self ._response
27452749
27462750 def upload_to_s3 (
@@ -2779,9 +2783,18 @@ def upload_to_s3(
27792783 file = io .BytesIO (mask_file .read ())
27802784 bucket .put_object (Key = image_info ["annotation_bluemap_path" ], Body = file )
27812785 return image_id_name_map [image_id ], True
2782- except Exception as _ :
2786+ except Exception as e :
2787+ self ._failed_annotation_reports .append (
2788+ {"image" : image_id_name_map [image_id ].name , "message" : str (e )}
2789+ )
27832790 return image_id_name_map [image_id ], False
27842791
2792+ def report_failed_annotations (self ):
2793+ for info in self ._failed_annotation_reports :
2794+ logger .warning (
2795+ f"Couldn't upload annotation { info ['image' ]} - { info ['message' ]} "
2796+ )
2797+
27852798 def report_missing_data (self ):
27862799 if self .missing_classes :
27872800 logger .warning (f"Couldn't find classes [{ ', ' .join (self .missing_classes )} ]" )
0 commit comments