Skip to content

Commit

Permalink
Add check for active LZ when getting UUID from LZ path
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolai-vKuegelgen committed Nov 13, 2023
1 parent 78ae06a commit 5d4bc85
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions cubi_tk/snappy/itransfer_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 6 additions & 8 deletions cubi_tk/sodar/ingest_fastq.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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 = []

Expand Down Expand Up @@ -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]
Expand All @@ -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:
Expand Down

0 comments on commit 5d4bc85

Please sign in to comment.