Skip to content

Commit e08fb25

Browse files
authored
fix: Wrap sync to ftp in a try block (#179)
1 parent cdcd64f commit e08fb25

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

ftpSummaryStatsScript/ftp_sync.py

+13-5
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,19 @@ def sync_to_ftp(self):
269269
continue
270270
logger.info("{} --> FTP".format(study))
271271
source = self.staging_studies_dict[study]
272-
self._generate_md5sums_for_contents(source)
273-
pardir = self._create_pardir_on_dest(source)
274-
if pardir:
275-
dest_dir = os.path.join(pardir, study + "/")
276-
self.rsync_dir(source, dest_dir)
272+
273+
try:
274+
self._generate_md5sums_for_contents(source)
275+
pardir = self._create_pardir_on_dest(source)
276+
if pardir:
277+
dest_dir = os.path.join(pardir, study + "/")
278+
self.rsync_dir(source, dest_dir)
279+
except FileNotFoundError as e:
280+
logger.error(f"Error processing the study {study}: {e}. Skipping.")
281+
continue
282+
except Exception as e:
283+
logger.error(f"Unexpected error processing study {study}: {e}. Skipping.")
284+
continue
277285
logger.info("==========================================")
278286

279287
@staticmethod

0 commit comments

Comments
 (0)