From ccff5cc5a0d06f79933d3b72edac644c22143b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20N=C3=B6the?= Date: Mon, 23 Oct 2017 16:52:53 +0200 Subject: [PATCH] Return list of failed files --- erna/automatic_processing/database_utils.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/erna/automatic_processing/database_utils.py b/erna/automatic_processing/database_utils.py index 6e1325f..1f9bcc2 100644 --- a/erna/automatic_processing/database_utils.py +++ b/erna/automatic_processing/database_utils.py @@ -181,11 +181,18 @@ def insert_new_job( @requires_database_connection def insert_new_jobs(raw_data_files, jar, xml, queue, progress=True, **kwargs): + failed_files = [] for f in tqdm(raw_data_files, total=raw_data_files.count(), disable=not progress): try: insert_new_job(f, jar=jar, xml=xml, queue=queue, **kwargs) except peewee.IntegrityError: - log.warning('Job already submitted: {} {}'.format(f.night, f.run_id)) + log.warning('Job already submitted: {}_{:03d}'.format(f.night, f.run_id)) + except ValueError as e: + log.warning('Could not submit {}_{:03d}: {}'.format( + f.night, f.run_id, e, + )) + failed_files.append(f) + return failed_files @requires_database_connection