Skip to content

Commit

Permalink
create initial classmethod interface
Browse files Browse the repository at this point in the history
  • Loading branch information
leoschwarz committed Aug 12, 2024
1 parent 06d1e62 commit 07cdcac
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/depiction_targeted_preprocbatch/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,13 @@ def run_job(self, job: BatchJob) -> None:
# export the results
# TODO do not hardcode id
output_storage = Storage.find(id=2, client=self._client)
JobExportResults(client=self._client, work_dir=self._work_dir, workunit_config=self._workunit_config).export(
sample_name=sample_dir.name, result_files=result_files, output_storage=output_storage
JobExportResults.export(
client=self._client,
work_dir=self._work_dir,
workunit_config=self._workunit_config,
sample_name=sample_dir.name,
result_files=result_files,
output_storage=output_storage,
)

def _determine_result_files(self, job_dir: Path) -> list[Path]:
Expand Down
16 changes: 15 additions & 1 deletion src/depiction_targeted_preprocbatch/job_export_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,21 @@ def __init__(self, client: Bfabric, work_dir: Path, workunit_config: WorkunitCon
self._workunit_config = workunit_config
self.output_dir = work_dir / "output"

def export(self, sample_name: str, result_files: list[Path], output_storage: Storage) -> None:
@classmethod
def export(
cls,
client: Bfabric,
work_dir: Path,
workunit_config: WorkunitConfig,
sample_name: str,
result_files: list[Path],
output_storage: Storage,
) -> None:
"""Exports the results of one job."""
instance = cls(client=client, work_dir=work_dir, workunit_config=workunit_config)
instance.export_results(sample_name, result_files, output_storage)

def export_results(self, sample_name: str, result_files: list[Path], output_storage: Storage) -> None:
"""Exports the results of one job."""
zip_file_path = self._create_zip_file(result_files, sample_name)
output_path_relative = self._copy_zip_to_storage(zip_file_path, output_storage)
Expand Down

0 comments on commit 07cdcac

Please sign in to comment.