Skip to content

Commit

Permalink
improve logging during chksum
Browse files Browse the repository at this point in the history
  • Loading branch information
sellth committed Dec 8, 2023
1 parent 1a58949 commit b3fadcc
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions cubi_tk/irods_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,17 +204,20 @@ def put(self, recursive: bool = False, sync: bool = False):
def chksum(self):
"""Compute remote md5 checksums for all jobs."""
common_prefix = os.path.commonpath(self.__destinations)
for job in self.__jobs:
if not job.path_local.endswith(".md5"):
output_logger.info(Path(job.path_remote).relative_to(common_prefix))
try:
with self.session as session:
data_object = session.data_objects.get(job.path_remote)
if not data_object.checksum:
data_object.chksum()
except Exception as e: # pragma: no cover
logger.error("Problem during iRODS checksumming.")
logger.error(self.get_irods_error(e))
checkjobs = tuple(job for job in self.__jobs if not job.path_remote.endswith(".md5"))
logger.info(f"Triggering remote checksum computation for {len(checkjobs)} files.")
for n, job in enumerate(checkjobs):
output_logger.info(
f"File [{n + 1}/{len(checkjobs)}]: {Path(job.path_remote).relative_to(common_prefix)}"
)
try:
with self.session as session:
data_object = session.data_objects.get(job.path_remote)
if not data_object.checksum:
data_object.chksum()
except Exception as e: # pragma: no cover
logger.error("Problem during iRODS checksumming.")
logger.error(self.get_irods_error(e))

def get(self):
"""Download files from SODAR."""
Expand Down

0 comments on commit b3fadcc

Please sign in to comment.