Skip to content

Commit

Permalink
Return list of failed files
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed Oct 23, 2017
1 parent 1ce9020 commit ccff5cc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion erna/automatic_processing/database_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ccff5cc

Please sign in to comment.