Skip to content

Commit

Permalink
fix(api): add documentation (#1646)
Browse files Browse the repository at this point in the history
  • Loading branch information
TLAIDI committed Aug 1, 2023
1 parent 2442c0f commit a2f0d23
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 23 deletions.
16 changes: 14 additions & 2 deletions antarest/study/common/studystorage.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,13 @@ def unarchive_study_output(
raise NotImplementedError()

def unarchive(self, study: T) -> None:
"""
Unarchived a study
Args:
study: StudyFactory
"""
raise NotImplementedError()

# def export_study_flat(self, **kwargs) -> None:
# raise NotImplementedError()
def export_study_flat(
self,
path_study: Path,
Expand All @@ -285,4 +288,13 @@ def export_study_flat(
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 of source outputs path
output_list_filter:list of outputs to keep
"""
raise NotImplementedError()
2 changes: 1 addition & 1 deletion antarest/study/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2166,7 +2166,7 @@ def unarchive(self, uuid: str, params: RequestParameters) -> str:

def unarchive_task(notifier: TaskUpdateNotifier) -> TaskResult:
study_to_archive = self.get_study(uuid)
self.storage_service.raw_study_service.unarchive(study_to_archive)
self.storage_service.raw_study_service.unarchived(study_to_archive)
study_to_archive.archived = False

os.unlink(
Expand Down
4 changes: 1 addition & 3 deletions antarest/study/storage/abstract_storage_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,9 @@ 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).
output_src_path: list of source outputs path.
"""
start_time = time.time()
output_src_path = output_src_path or path_study / "output"
Expand Down
2 changes: 1 addition & 1 deletion antarest/study/storage/rawstudy/raw_study_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ def archive(self, study: RawStudy) -> Path:
self.cache.invalidate(study.id)
return new_study_path

def unarchive(self, study: RawStudy) -> None:
def unarchived(self, study: RawStudy) -> None:
with open(
self.get_archive_path(study),
"rb",
Expand Down
17 changes: 1 addition & 16 deletions antarest/study/storage/variantstudy/variant_study_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,21 +839,6 @@ def _generate(

if last_executed_command_index is None:
if isinstance(parent_study, VariantStudy):
# self._safe_generation(parent_study)
# self.export_study_flat(
# metadata=parent_study,
# dst_path=dst_path,
# outputs=False,
# denormalize=False,
# )
# else:
# self.raw_study_service.export_study_flat(
# metadata=parent_study,
# dst_path=dst_path,
# outputs=False,
# denormalize=False,
# )

self._safe_generation(parent_study)
path_study = Path(parent_study.path)
snapshot_path = path_study / SNAPSHOT_RELATIVE_PATH
Expand All @@ -867,7 +852,7 @@ def _generate(
else:
path_study = Path(parent_study.path)
if parent_study.archived:
self.raw_study_service.unarchive(parent_study)
self.raw_study_service.unarchived(parent_study)
try:
self.raw_study_service.export_study_flat(
path_study=path_study,
Expand Down

0 comments on commit a2f0d23

Please sign in to comment.