From 8dcea88e11f76c62ddd315c58f499ea0a0e61051 Mon Sep 17 00:00:00 2001 From: Marnik Bercx Date: Wed, 20 Dec 2023 17:47:39 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=8C=20Catch=20all=20`Exception`s=20dur?= =?UTF-8?q?ing=20submission=20loop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of only catching `ValueError`, `TypeError` and `AttributeError`, catch a generic `Exception` and log the failure is the submission failed for a certain set of extras. Although this is generally not considered good practise, catching a generic `Exception` here makes sense since we're trying to report any kind of failure, even potentially custom subclasses of `Exception`. Now the `submit_new_batch` method will no longer break because of one faulty submission. --- aiida_submission_controller/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aiida_submission_controller/base.py b/aiida_submission_controller/base.py index 6e104dd..f6319c8 100644 --- a/aiida_submission_controller/base.py +++ b/aiida_submission_controller/base.py @@ -212,7 +212,7 @@ def submit_new_batch(self, dry_run=False, sort=True, verbose=False): # Actually submit wc_node = engine.submit(builder) - except (ValueError, TypeError, AttributeError) as exc: + except Exception as exc: CMDLINE_LOGGER.error(f"Failed to submit work chain for extras <{workchain_extras}>: {exc}") else: CMDLINE_LOGGER.report(f"Submitted work chain <{wc_node}> for extras <{workchain_extras}>.")