From 5d4bc85988c31f692b9581dc4b65237337d97557 Mon Sep 17 00:00:00 2001 From: Nicolai-vKuegelgen Date: Mon, 13 Nov 2023 13:47:51 +0100 Subject: [PATCH] Add check for active LZ when getting UUID from LZ path --- cubi_tk/snappy/itransfer_common.py | 4 ++-- cubi_tk/sodar/ingest_fastq.py | 14 ++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/cubi_tk/snappy/itransfer_common.py b/cubi_tk/snappy/itransfer_common.py index 81ddd6ae..7c5abb1a 100644 --- a/cubi_tk/snappy/itransfer_common.py +++ b/cubi_tk/snappy/itransfer_common.py @@ -489,10 +489,10 @@ def get_landing_zone_uuid_by_path(self, lz_irods_path, project_uuid, assay_uuid= existing_lzs = list(filter(lambda x: x.assay == assay_uuid, existing_lzs)) matching_lzs = list(filter(lambda x: x.irods_path == lz_irods_path, existing_lzs)) - if matching_lzs: + if matching_lzs and matching_lzs[0].status == 'ACTIVE': lz_uuid = matching_lzs[0].sodar_uuid else: - msg = "Could not find LZ with given path. Please review input: {0}".format( + msg = "Could not find an active LZ with the given path. Please review input: {0}".format( lz_irods_path ) logger.error(msg) diff --git a/cubi_tk/sodar/ingest_fastq.py b/cubi_tk/sodar/ingest_fastq.py index 43efe0ff..2d1cc761 100644 --- a/cubi_tk/sodar/ingest_fastq.py +++ b/cubi_tk/sodar/ingest_fastq.py @@ -361,7 +361,8 @@ def build_jobs(self, library_names=None): """Build file transfer jobs.""" if library_names: logger.warning( - "will ignore parameter 'library_names' = %s in build_jobs()", str(library_names) + "will ignore parameter 'library_names' = %s in ingest_fastq.build_jobs()", + str(library_names), ) lz_uuid, lz_irods_path = self.get_sodar_info() @@ -373,9 +374,6 @@ def build_jobs(self, library_names=None): else: column_match = None - # This collects input folders and downloads them if they are webdav locations - # Note: the webdav support here might not be documented. If useful it should maybe be - # made available for all itransfer commands. folders = self.download_webdav(self.args.sources) transfer_jobs = [] @@ -414,7 +412,7 @@ def build_jobs(self, library_names=None): remote_file = pathlib.Path( lz_irods_path ) / self.args.remote_dir_pattern.format( - # Removed the `+ self.args.add_suffix` here, since anything after the file extension is a bad idea + # Removed the `+ self.args.add_suffix` here, since adding anything after the file extension is a bad idea filename=pathlib.Path(path).name, date=self.args.remote_dir_date, collection_name=column_match[sample_name] @@ -424,13 +422,13 @@ def build_jobs(self, library_names=None): ) except KeyError: msg = ( - f"Could not match extracted sample name '{sample_name}' to any value in the " - "--match-column. Please review the assay table, src-regex and sample-collection-mapping args." + f"Could not match extracted sample value '{sample_name}' to any value in the " + f"--match-column {self.args.match_column}. Please review the assay table, src-regex and sample-collection-mapping args." ) logger.error(msg) raise ParameterException(msg) - # This would the original code, but there is no need to change the remote file names once they are + # This was the original code, but there is no need to change the remote file names once they are # mapped to the correct collections: # remote_file = str(remote_file) # for m_pat, r_pat in self.args.remote_dir_mapping: