From ae97838d5b1fde0451d582e90457d351c13c4908 Mon Sep 17 00:00:00 2001 From: ZDu-IDM Date: Thu, 14 Nov 2024 13:16:56 -0800 Subject: [PATCH 1/2] check suite existence before delete --- .../comps_operations/suite_operations.py | 6 +++++- .../platform_operations/suite_operations.py | 6 +++++- .../platform_operations/suite_operations.py | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/idmtools_platform_comps/idmtools_platform_comps/comps_operations/suite_operations.py b/idmtools_platform_comps/idmtools_platform_comps/comps_operations/suite_operations.py index 7b8f6e93b..06c291856 100644 --- a/idmtools_platform_comps/idmtools_platform_comps/comps_operations/suite_operations.py +++ b/idmtools_platform_comps/idmtools_platform_comps/comps_operations/suite_operations.py @@ -172,7 +172,11 @@ def platform_delete(self, suite_id: str) -> None: Returns: None """ - comps_suite = self.platform.get_item(suite_id, ItemType.SUITE, raw=True) + try: + comps_suite = self.platform.get_item(suite_id, ItemType.SUITE, raw=True) + except ValueError: + return + comps_exps = comps_suite.get_experiments() for comps_exp in comps_exps: try: diff --git a/idmtools_platform_general/idmtools_platform_file/platform_operations/suite_operations.py b/idmtools_platform_general/idmtools_platform_file/platform_operations/suite_operations.py index 72a902c8d..0cee10c3a 100644 --- a/idmtools_platform_general/idmtools_platform_file/platform_operations/suite_operations.py +++ b/idmtools_platform_general/idmtools_platform_file/platform_operations/suite_operations.py @@ -165,7 +165,11 @@ def platform_delete(self, suite_id: str) -> None: Returns: None """ - suite = self.platform.get_item(suite_id, ItemType.SUITE, force=True, raw=False) + try: + suite = self.platform.get_item(suite_id, ItemType.SUITE, force=True, raw=False) + except RuntimeError: + return + exps = suite.experiments for exp in exps: try: diff --git a/idmtools_platform_slurm/idmtools_platform_slurm/platform_operations/suite_operations.py b/idmtools_platform_slurm/idmtools_platform_slurm/platform_operations/suite_operations.py index 48183d2b7..f666f4480 100644 --- a/idmtools_platform_slurm/idmtools_platform_slurm/platform_operations/suite_operations.py +++ b/idmtools_platform_slurm/idmtools_platform_slurm/platform_operations/suite_operations.py @@ -164,7 +164,11 @@ def platform_delete(self, suite_id: str) -> None: Returns: None """ - suite = self.platform.get_item(suite_id, ItemType.SUITE, force=True, raw=False) + try: + suite = self.platform.get_item(suite_id, ItemType.SUITE, force=True, raw=False) + except RuntimeError: + return + exps = suite.experiments for exp in exps: try: From bc0994550f7adc68ddd97d3aa4b8b17f44f42bac Mon Sep 17 00:00:00 2001 From: ZDu-IDM Date: Fri, 15 Nov 2024 11:12:30 -0800 Subject: [PATCH 2/2] catch RuntimeError instead. --- .../comps_operations/suite_operations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/idmtools_platform_comps/idmtools_platform_comps/comps_operations/suite_operations.py b/idmtools_platform_comps/idmtools_platform_comps/comps_operations/suite_operations.py index 06c291856..6d45cf689 100644 --- a/idmtools_platform_comps/idmtools_platform_comps/comps_operations/suite_operations.py +++ b/idmtools_platform_comps/idmtools_platform_comps/comps_operations/suite_operations.py @@ -174,7 +174,7 @@ def platform_delete(self, suite_id: str) -> None: """ try: comps_suite = self.platform.get_item(suite_id, ItemType.SUITE, raw=True) - except ValueError: + except RuntimeError: return comps_exps = comps_suite.get_experiments()