From 8dc2227cfb8503b437f3f975436f31da7124919f Mon Sep 17 00:00:00 2001 From: Marvin Poul Date: Mon, 12 Aug 2024 16:21:58 +0200 Subject: [PATCH 1/2] Catch all exception in pyiron table --- pyiron_base/jobs/datamining.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/pyiron_base/jobs/datamining.py b/pyiron_base/jobs/datamining.py index 589bf5652..ac4cf8f71 100644 --- a/pyiron_base/jobs/datamining.py +++ b/pyiron_base/jobs/datamining.py @@ -844,15 +844,9 @@ def always_true(_): return True -def _apply_function_on_job(funct, job): - try: - return funct(job) - except (ValueError, TypeError): - return {} - - def _apply_list_of_functions_on_job(input_parameters): from pyiron_base.jobs.job.path import JobPath + from pyiron_snippets.logger import logger db_entry, function_lst, convert_to_object = input_parameters job = JobPath.from_db_entry(db_entry) @@ -861,7 +855,8 @@ def _apply_list_of_functions_on_job(input_parameters): job.set_input_to_read_only() diff_dict = {} for funct in function_lst: - funct_dict = _apply_function_on_job(funct, job) - for key, value in funct_dict.items(): - diff_dict[key] = value + try: + diff_dict.update(funct(job)) + except Exception as e: + logger.warn(f"Caught exception '{e}' when called on job {job.id}!") return diff_dict From 707c5d2407112e53c138f08f316979ed46da33dc Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 09:48:28 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyiron_base/jobs/datamining.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyiron_base/jobs/datamining.py b/pyiron_base/jobs/datamining.py index ac4cf8f71..cf2a67309 100644 --- a/pyiron_base/jobs/datamining.py +++ b/pyiron_base/jobs/datamining.py @@ -845,9 +845,10 @@ def always_true(_): def _apply_list_of_functions_on_job(input_parameters): - from pyiron_base.jobs.job.path import JobPath from pyiron_snippets.logger import logger + from pyiron_base.jobs.job.path import JobPath + db_entry, function_lst, convert_to_object = input_parameters job = JobPath.from_db_entry(db_entry) if convert_to_object: