diff --git a/antarest/study/common/studystorage.py b/antarest/study/common/studystorage.py index eb3f561448..59d6311dbf 100644 --- a/antarest/study/common/studystorage.py +++ b/antarest/study/common/studystorage.py @@ -253,30 +253,3 @@ def archive_study_output(self, study: T, output_id: str) -> bool: @abstractmethod 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 f5c5b5a164..c2e7d5da8b 100644 --- a/antarest/study/service.py +++ b/antarest/study/service.py @@ -922,6 +922,7 @@ def export_task(notifier: TaskUpdateNotifier) -> TaskResult: 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: storage.unarchive(target_study) try: @@ -1035,6 +1036,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: @@ -1048,15 +1050,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) -> None: """