|
11 | 11 | from lib.core.entities import ProjectEntity |
12 | 12 | from lib.core.entities import TmpBaseEntity |
13 | 13 | from lib.core.entities import TmpImageEntity |
14 | | -from lib.core.entities import VideoEntity |
15 | 14 | from lib.core.exceptions import AppException |
16 | 15 | from lib.core.exceptions import AppValidationException |
17 | 16 | from lib.core.exceptions import BackendError |
@@ -54,7 +53,8 @@ def serialize_entity(entity: Entity, project: ProjectEntity): |
54 | 53 | tmp_entity.segmentation_status = None |
55 | 54 | return TmpImageEntity(**tmp_entity.dict(by_alias=True)) |
56 | 55 | elif project.type == constances.ProjectType.VIDEO.value: |
57 | | - return VideoEntity(**entity.dict(by_alias=True)) |
| 56 | + return |
| 57 | + |
58 | 58 | elif project.type == constances.ProjectType.DOCUMENT.value: |
59 | 59 | return DocumentEntity(**entity.dict(by_alias=True)) |
60 | 60 | return entity |
@@ -245,6 +245,7 @@ def execute(self) -> Response: |
245 | 245 | if self.is_valid(): |
246 | 246 | duplications = [] |
247 | 247 | attached = [] |
| 248 | + self.reporter.start_progress(self.attachments_count, "Attaching URLs") |
248 | 249 | for i in range(0, self.attachments_count, self.CHUNK_SIZE): |
249 | 250 | attachments = self._attachments[i: i + self.CHUNK_SIZE] # noqa: E203 |
250 | 251 | response = self._backend_service.get_bulk_images( |
@@ -276,6 +277,8 @@ def execute(self) -> Response: |
276 | 277 | self._response.errors = AppException(backend_response["error"]) |
277 | 278 | else: |
278 | 279 | attached.extend(backend_response) |
| 280 | + self.reporter.update_progress(len(attachments)) |
| 281 | + self.reporter.finish_progress() |
279 | 282 | self._response.data = attached, duplications |
280 | 283 | return self._response |
281 | 284 |
|
@@ -363,7 +366,7 @@ def execute(self): |
363 | 366 | include_annotations=self._include_annotations, |
364 | 367 | ) |
365 | 368 | if not poll_id: |
366 | | - skipped_images.append(chunk_to_copy) |
| 369 | + skipped_items.extend(chunk_to_copy) |
367 | 370 | continue |
368 | 371 | try: |
369 | 372 | self._backend_service.await_progress( |
@@ -467,4 +470,3 @@ def execute(self): |
467 | 470 |
|
468 | 471 | self._response.data = list(set(items) - set(moved_images)) |
469 | 472 | return self._response |
470 | | - |
|
0 commit comments