diff --git a/extensions/chaeo/util.py b/extensions/chaeo/util.py index 60186ef58c4e829e7d490c027d69ac4b2df32236..a713180159bdf7a6b863dabcc5fef4ede4b8caee 100644 --- a/extensions/chaeo/util.py +++ b/extensions/chaeo/util.py @@ -50,7 +50,7 @@ def get_matching_files(where: str, ext: str, coord_filter: dict={}) -> str: def loop_workflow(files, where_output, workflow_func, params, - write_intermediate_products=True): + write_intermediate_products=True, catch_and_continue=True): failures = [] for ii, ff in enumerate(files): export_kwargs = { @@ -63,12 +63,15 @@ def loop_workflow(files, where_output, workflow_func, params, try: result = workflow_func(**export_kwargs) except Exception as e: - failures.append({ - 'input_file': ff, - 'error_message': e.__str__(), - }) - print(f'Caught failure on {ff}:\n{e.__str__()}') - continue + if catch_and_continue: + failures.append({ + 'input_file': ff, + 'error_message': e.__str__(), + }) + print(f'Caught failure on {ff}:\n{e.__str__()}') + continue + else: + raise e # record dataframes associated with workflow results batch_csv = {