diff --git a/antarest/study/service.py b/antarest/study/service.py index 1523434822..f4bb7304dd 100644 --- a/antarest/study/service.py +++ b/antarest/study/service.py @@ -1039,6 +1039,7 @@ def export_study_flat( try: return export_study_flat( path_study=path_study, + study_factory=study, dest=dest, outputs=len(output_list or []) > 0, output_list_filter=output_list, @@ -1050,6 +1051,7 @@ def export_study_flat( output_src_path = path_study / "output" export_study_flat( path_study=snapshot_path, + study_factory=study, dest=dest, outputs=len(output_list or []) > 0, output_list_filter=output_list, diff --git a/antarest/study/storage/abstract_storage_service.py b/antarest/study/storage/abstract_storage_service.py index bc466580cd..be565c6127 100644 --- a/antarest/study/storage/abstract_storage_service.py +++ b/antarest/study/storage/abstract_storage_service.py @@ -39,6 +39,7 @@ def export_study_flat( path_study: Path, dest: Path, + study_factory: StudyFactory, outputs: bool = True, output_list_filter: Optional[List[str]] = None, output_src_path: Optional[Path] = None, @@ -49,6 +50,7 @@ def export_study_flat( Args: path_study: Study source path dest: Destination path. + study_factory: StudyFactory, outputs: List of outputs to keep. output_list_filter: List of outputs to keep (None indicate all outputs). output_src_path: Denormalize the study (replace matrix links by real matrices). @@ -89,6 +91,11 @@ def export_study_flat( duration = "{:.3f}".format(stop_time - start_time) logger.info(f"Study {path_study} exported (flat mode) in {duration}s") + study = study_factory.create_from_fs(dest, "", use_cache=False) + study.tree.denormalize() + duration = "{:.3f}".format(time.time() - stop_time) + logger.info(f"Study {path_study} denormalized in {duration}s") + class AbstractStorageService(IStudyStorageService[T], ABC): def __init__( @@ -293,11 +300,14 @@ def export_study(self, metadata: T, target: Path, outputs: bool = True) -> Path: output_src_path = path_study / "output" export_study_flat( path_study=snapshot_path, + study_factory=self.study_factory, dest=tmp_study_path, outputs=outputs, output_src_path=output_src_path, ) - export_study_flat(path_study, tmp_study_path, outputs) + export_study_flat( + path_study, tmp_study_path, self.study_factory, outputs + ) stopwatch = StopWatch() zip_dir(tmp_study_path, target) stopwatch.log_elapsed(lambda x: logger.info(f"Study {path_study} exported (zipped mode) in {x}s")) diff --git a/antarest/study/storage/variantstudy/variant_study_service.py b/antarest/study/storage/variantstudy/variant_study_service.py index 61ff09f025..db134d18ad 100644 --- a/antarest/study/storage/variantstudy/variant_study_service.py +++ b/antarest/study/storage/variantstudy/variant_study_service.py @@ -726,6 +726,7 @@ def _generate( export_study_flat( snapshot_path, dst_path, + parent_study, outputs=False, output_src_path=output_src_path, ) @@ -737,6 +738,7 @@ def _generate( export_study_flat( path_study=path_study, dest=dst_path, + study_factory=parent_study, outputs=False, ) finally: