File tree Expand file tree Collapse file tree 1 file changed +19
-5
lines changed
src/superannotate/lib/core/usecases Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -409,6 +409,7 @@ def execute(self):
409409class UploadAnnotationsFromFolderUseCase (BaseReportableUseCase ):
410410 MAX_WORKERS = 16
411411 CHUNK_SIZE = 100
412+ CHUNK_SIZE_PATHS = 500
412413 CHUNK_SIZE_MB = 10 * 1024 * 1024
413414 STATUS_CHANGE_CHUNK_SIZE = 100
414415 AUTH_DATA_CHUNK_SIZE = 500
@@ -579,14 +580,27 @@ def get_existing_name_item_mapping(
579580
580581 @property
581582 def annotation_upload_data (self ) -> UploadAnnotationAuthData :
582- if not self ._annotation_upload_data :
583- response = self ._service_provider .get_annotation_upload_data (
583+ CHUNK_SIZE = UploadAnnotationsFromFolderUseCase .CHUNK_SIZE_PATHS
584+
585+ if self ._annotation_upload_data :
586+ return self ._annotation_upload_data
587+
588+ images = {}
589+ for i in range (0 , len (self ._item_ids ), CHUNK_SIZE ):
590+ tmp = self ._service_provider .get_annotation_upload_data (
584591 project = self ._project ,
585592 folder = self ._folder ,
586- item_ids = self ._item_ids ,
593+ item_ids = self ._item_ids [i :i + CHUNK_SIZE ],
594+
587595 )
588- if response .ok :
589- self ._annotation_upload_data = response .data
596+ if not tmp .ok :
597+ raise AppException (tmp .errors )
598+ else :
599+ images .update (tmp .data .images )
600+
601+ self ._annotation_upload_data = tmp .data
602+ self ._annotation_upload_data .images = images
603+
590604 return self ._annotation_upload_data
591605
592606 @property
You can’t perform that action at this time.
0 commit comments