diff --git a/antarest/study/common/studystorage.py b/antarest/study/common/studystorage.py index ba53bd4576..c804c864e9 100644 --- a/antarest/study/common/studystorage.py +++ b/antarest/study/common/studystorage.py @@ -271,30 +271,3 @@ def unarchive_study_output( self, study: T, output_id: str, keep_src_zip: bool ) -> bool: raise NotImplementedError() - - def unarchive(self, study: T) -> None: - """ - Unarchived a study - Args: - study: StudyFactory - """ - raise NotImplementedError() - - def export_study_flat( - self, - path_study: Path, - dst_path: Path, - outputs: bool = True, - output_src_path: Optional[Path] = None, - output_list_filter: Optional[List[str]] = None, - ) -> None: - """ - Export study to destination - Args: - path_study: source path. - dst_path: destination path. - outputs: list of outputs to keep. - output_src_path: list output path - output_list_filter:list of outputs to keep - """ - raise NotImplementedError() diff --git a/antarest/study/service.py b/antarest/study/service.py index 41200430cd..f891710288 100644 --- a/antarest/study/service.py +++ b/antarest/study/service.py @@ -1091,15 +1091,15 @@ def export_study( def export_task(notifier: TaskUpdateNotifier) -> TaskResult: try: target_study = self.get_study(uuid) + storage = self.storage_service.get_storage(target_study) if isinstance(target_study, RawStudy): + storage = cast(RawStudyService, storage) if target_study.archived: - self.storage_service.get_storage( - target_study - ).unarchive(target_study) + storage.unarchive(target_study) try: - self.storage_service.get_storage( - target_study - ).export_study(target_study, export_path, outputs) + storage.export_study( + target_study, export_path, outputs + ) finally: if target_study.archived: shutil.rmtree(target_study.path) @@ -1220,6 +1220,7 @@ def export_study_flat( path_study = Path(study.path) storage = self.storage_service.get_storage(study) if isinstance(study, RawStudy): + storage = cast(RawStudyService, storage) if study.archived: storage.unarchive(study) try: @@ -1233,15 +1234,17 @@ def export_study_flat( finally: if study.archived: shutil.rmtree(study.path) - snapshot_path = path_study / "snapshot" - output_src_path = path_study / "output" - return storage.export_study_flat( - path_study=snapshot_path, - dst_path=dest, - outputs=len(output_list or []) > 0, - output_list_filter=output_list, - output_src_path=output_src_path, - ) + else: + snapshot_path = path_study / "snapshot" + output_src_path = path_study / "output" + storage = cast(VariantStudyService, storage) + return storage.export_study_flat( + path_study=snapshot_path, + dst_path=dest, + outputs=len(output_list or []) > 0, + output_list_filter=output_list, + output_src_path=output_src_path, + ) def delete_study( self, uuid: str, children: bool, params: RequestParameters