Skip to content

Commit

Permalink
deactivate delete_default_resource because this is currently impossib…
Browse files Browse the repository at this point in the history
…le with the current wrapper creator code
  • Loading branch information
leoschwarz committed Aug 20, 2024
1 parent 1759d61 commit c2ec20a
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/depiction_targeted_preprocbatch/job_export_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
{
Expand All @@ -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

0 comments on commit c2ec20a

Please sign in to comment.