diff --git a/src/depiction_targeted_preprocbatch/executor.py b/src/depiction_targeted_preprocbatch/executor.py index 47e1494..9810a25 100644 --- a/src/depiction_targeted_preprocbatch/executor.py +++ b/src/depiction_targeted_preprocbatch/executor.py @@ -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]: diff --git a/src/depiction_targeted_preprocbatch/job_export_results.py b/src/depiction_targeted_preprocbatch/job_export_results.py index 4951533..8345f38 100644 --- a/src/depiction_targeted_preprocbatch/job_export_results.py +++ b/src/depiction_targeted_preprocbatch/job_export_results.py @@ -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)