@@ -49,6 +49,7 @@ def __init__(
4949 validators : BaseAnnotationValidator ,
5050 pre_annotation : bool = False ,
5151 client_s3_bucket = None ,
52+ folder_path : str = None ,
5253 ):
5354 super ().__init__ (reporter )
5455 self ._project = project
@@ -66,6 +67,7 @@ def __init__(
6667 self .missing_attribute_groups = set ()
6768 self .missing_classes = set ()
6869 self .missing_attributes = set ()
70+ self ._folder_path = folder_path
6971
7072 @property
7173 def annotation_postfix (self ):
@@ -173,7 +175,6 @@ def _upload_annotation(
173175 validators = self ._validators ,
174176 ).execute ()
175177 if response .errors :
176- self .reporter .store_message ("Invalid jsons" , path )
177178 return path , False
178179 return path , True
179180 except Exception as _ :
@@ -193,14 +194,23 @@ def get_bucket_to_upload(self, ids: List[int]):
193194
194195 def _log_report (self ):
195196 for key , values in self .reporter .custom_messages .items ():
196- template = key + ": {}"
197- if key == "missing_classes" :
198- template = "Could not find annotation classes matching existing classes on the platform: [{}]"
199- elif key == "missing_attribute_groups" :
200- template = "Could not find attribute groups matching existing attribute groups on the platform: [{}]"
201- elif key == "missing_attributes" :
202- template = "Could not find attributes matching existing attributes on the platform: [{}]"
203- logger .warning (template .format ("', '" .join (values )))
197+ if key in [
198+ "missing_classes" ,
199+ "missing_attribute_groups" ,
200+ "missing_attributes" ,
201+ ]:
202+ template = key + ": {}"
203+ if key == "missing_classes" :
204+ template = "Could not find annotation classes matching existing classes on the platform: [{}]"
205+ elif key == "missing_attribute_groups" :
206+ template = "Could not find attribute groups matching existing attribute groups on the platform: [{}]"
207+ elif key == "missing_attributes" :
208+ template = "Could not find attributes matching existing attributes on the platform: [{}]"
209+ logger .warning (template .format ("', '" .join (values )))
210+ if self .reporter .custom_messages .get ("invalid_jsons" ):
211+ logger .warning (
212+ f"Couldn't validate { len (self .reporter .custom_messages ['invalid_jsons' ])} /{ len (self ._annotations_to_upload + self ._missing_annotations )} annotations from { self ._folder_path } ."
213+ )
204214
205215 def execute (self ):
206216 uploaded_annotations = []
@@ -457,4 +467,5 @@ def execute(self):
457467 )
458468 else :
459469 self ._response .errors = "Invalid json"
470+ self .reporter .store_message ("invalid_jsons" , self ._annotation_path )
460471 return self ._response
0 commit comments