From c2ec20a763b411c0dcd87f73ec4d68b591b8aa21 Mon Sep 17 00:00:00 2001 From: Leonardo Schwarz Date: Tue, 20 Aug 2024 10:33:23 +0200 Subject: [PATCH] deactivate delete_default_resource because this is currently impossible with the current wrapper creator code --- .../job_export_results.py | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/depiction_targeted_preprocbatch/job_export_results.py b/src/depiction_targeted_preprocbatch/job_export_results.py index 555bce8..3955092 100644 --- a/src/depiction_targeted_preprocbatch/job_export_results.py +++ b/src/depiction_targeted_preprocbatch/job_export_results.py @@ -75,6 +75,7 @@ def _create_zip_file(self, result_files: list[Path], sample_name: str) -> Path: def _register_zip_in_workunit(self, output_path_relative: Path, zip_file_path: Path) -> None: checksum = FileChecksums(file_path=zip_file_path).checksum_md5 + # TODO this somehow seems to be executed multiple times and fails... self._client.save( "resource", { @@ -100,15 +101,20 @@ def delete_default_resource(workunit_id: int, client: Bfabric) -> bool: """Deletes the default resource created by the wrapper creator if it exists. Returns true if the resource was successfully deleted. """ - resources = Resource.find_by( - {"name": "MSI_Targeted_PreprocBatch 0 - resource", "workunitid": workunit_id}, client=client + logger.warning( + "Currently, the wrapper creator has a limitation that makes it impossible to remove " + "this resource. This will be addressed in the future." ) - if len(resources) == 1: - resource_id = list(resources.values())[0].id - logger.info(f"Deleting default resource with ID {resource_id}") - result = client.delete("resource", resource_id, check=False) - return result.is_success - elif len(resources) > 1: - raise ValueError("There should never be more than one default resource.") - else: - return False + if False: + resources = Resource.find_by( + {"name": "MSI_Targeted_PreprocBatch 0 - resource", "workunitid": workunit_id}, client=client + ) + if len(resources) == 1: + resource_id = list(resources.values())[0].id + logger.info(f"Deleting default resource with ID {resource_id}") + result = client.delete("resource", resource_id, check=False) + return result.is_success + elif len(resources) > 1: + raise ValueError("There should never be more than one default resource.") + else: + return False